User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 397,526 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,653 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 1766 | 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: 59
Reputation: venkatramasamy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
venkatramasamy's Avatar
venkatramasamy venkatramasamy is offline Offline
Junior Poster in Training

Help Re: fill listbox with data from another table

  #2  
Dec 25th, 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 25th, 2007 at 11:18 pm.
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)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 2:33 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC