RSS Forums RSS
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 2549 | Replies: 1
Reply
Join Date: Dec 2007
Posts: 29
Reputation: kartik07 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kartik07 kartik07 is offline Offline
Light Poster

fill listbox with data from another table

  #1  
Dec 25th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Posts: 71
Reputation: venkatramasamy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 12
venkatramasamy's Avatar
venkatramasamy venkatramasamy is offline Offline
Junior Poster in Training

Help Re: fill listbox with data from another table

  #2  
Dec 26th, 2007
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
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:55 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC