Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 8th, 2006, 3:29 AM   #1
Mitsuki
Newbie
 
Mitsuki's Avatar
 
Join Date: Apr 2006
Posts: 8
Rep Power: 0 Mitsuki is on a distinguished road
listbox selection

Hi I need help please

I have 2 listboxes and 2 tables

The first listbox will retreive the items from table 1
and if needed will move it to the second listbox when moved to the second listbox it should be inserted in table 2

I just want to understand the idea .. am running out of time please can someone spare sometime to help me ...??

I would really appreciate it ...


Thank you in advance
Mitsuki is offline   Reply With Quote
Old May 30th, 2006, 5:00 PM   #2
mjhoagland
Newbie
 
Join Date: May 2006
Posts: 5
Rep Power: 0 mjhoagland is on a distinguished road
If you still need help, this is simple enough. The code should look something like this:

Sub Load_listbox1()
     Dim row as DataRow

     For Each row1 in table1.Rows
          '0 is to represent the zero-based index of the column you're pulling from.
          listbox1.Items.Add = Cstr(row1(0))
     Next
End Sub

Sub Move_To_listbox2()
     listbox2.Items.Add = listbox1.SelectedValue
End Sub

Sub Update_Table2()
     'Delcare SQL Command and Connection parameters here
     'The SQL code to update Table2 should look something like "INSERT INTO Table 2 (column_name = '" & listbox2.SelectedValue & "')"

     'Then query against table2 and pull it into a dataset and from the dataset repopulate listbox2
     Dim row as DataRow

     For Each row in table2.Rows
          '0 is to represent the zero-based index of the column you're pulling from.
          listbox2.Items.Add = Cstr(row(0))
     Next
End Sub

Please note this sample code doesn't use ADO.NET so much as direct updating and querying. This code also assumes that your table objects are globally accessible by the code. If you're still around to ask questions, please do so.
mjhoagland is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:14 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC