Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 2549 | Replies: 1
![]() |
•
•
•
•
| |
•
•
Join Date: Dec 2007
Posts: 29
Reputation:
Rep Power: 1
Solved Threads: 0
Hi,I am new to VB6 and doin a project on it.
1.)
I need to create a Listbox in a form1 which wil display data from
another table in DB(MS ACCESS).Whenever any changes occur in that table,it should get
reflected in the listbox.
Ex:We have a table containing country names like India,America,australia.
Now in form1, I need to show the above countries as a listbox.If I delete America
from the DB table,it should reflect on the listbox
2.)
a = "insert into ATM1 values (" & CInt(Trim(Text1.Text)) & ",'" & Text2.Text & "')"
Can anyone pl explain the above syntax.ie where and why & ' " occur
1.)
I need to create a Listbox in a form1 which wil display data from
another table in DB(MS ACCESS).Whenever any changes occur in that table,it should get
reflected in the listbox.
Ex:We have a table containing country names like India,America,australia.
Now in form1, I need to show the above countries as a listbox.If I delete America
from the DB table,it should reflect on the listbox
2.)
a = "insert into ATM1 values (" & CInt(Trim(Text1.Text)) & ",'" & Text2.Text & "')"
Can anyone pl explain the above syntax.ie where and why & ' " occur
HI Karthic
To load items in the list box use the below code,
(i assumed Rs as your record set)...
[code]
rs.movefirst
For i=0 to rs.recordcount
list1.additem=rs!Country
rs.movenext
next
[\code]
To delete an item from the database and reflect the change in List box,use the following code
and about your secod question...
In the query string is recognized only when they placed between the ' and '
and the & symbol is concaternation operator, it concatenates the strings
I hope this will helpfull to you
With regards
Venkatramasamy SN
To load items in the list box use the below code,
(i assumed Rs as your record set)...
[code]
rs.movefirst
For i=0 to rs.recordcount
list1.additem=rs!Country
rs.movenext
next
[\code]
To delete an item from the database and reflect the change in List box,use the following code
Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then
rs.Delete "Select coutry from TableName where Coutry='" & List1.Text & "'"
list1.clear
rs.movefirst
For i=0 to rs.recordcount
list1.additem=rs!Country
rs.movenext
next
End If
End Sub
and about your secod question...
In the query string is recognized only when they placed between the ' and '
and the & symbol is concaternation operator, it concatenates the strings
I hope this will helpfull to you
With regards
Venkatramasamy SN
Last edited by venkatramasamy : Dec 26th, 2007 at 12:18 am.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Hybrid Mode