Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeellllllllllllllllllllllllllllllllppppppppppppppppppppppp
 

heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeellllllllllllllllllllllllllllllllppppppppppppppppppppppp

Please help i really need help on this code It's very simple i want to display selected text from a listbox to another

this code works a little bit but not perfect what happends is
when i press the button the display is the indxname or number but not the selected item

For
index As Integer = Lstbeh.Items.Count = -1 To 0 Step -1

If Lstbeh.GetSelected(index) = True Then

Dim objgeselected As DataRowView = Lstbeh.Items(index)

Klant_en_besteding.lsttotaalbeh.Items.Add(objgeselected(index).ToString)

End If

  • Changed TypeAland LiMSFT, ModeratorWednesday, August 12, 2009 1:29 PMNo reply
  • Moved byVMazurMVPWednesday, August 05, 2009 10:13 AM (From:ADO.NET Data Providers)
  •  
cliftonmenig  Wednesday, August 05, 2009 5:28 AM

Hi cliftonmenig,

From your code snippet, you bind a DataTable or a DataView to the ListBox. In your code snippet, you wrote:
Klant_en_besteding.lsttotaalbeh.Items.Add(objgeselected(index).ToString)

From my experience, you need to change this line to:
Klant_en_besteding.lsttotaalbeh.Items.Add(objgeselected)

You also need to set the DataSource, DisplayMember and ValueMember properties appropriately. This is a sample:
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/3094cd56-f33a-4cb7-9890-9d0c12dcdef6.

Let me know if this helps.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, August 06, 2009 7:50 AM

Hi,

We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, August 12, 2009 1:29 PM
Also, please name your post appropriately if you expect others to contribute and offer assistence.

John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com
JohnGrove  Wednesday, August 12, 2009 9:45 PM

You can use google to search for other answers

Custom Search

More Threads

• DataGridView ComboBox list appears in wrong place on UI
• DataGridView, Binding Navigator, and Multiple BindingSources
• using binding context
• DataTable Acts As Intermediator For DataGridView
• Problem with Listbox and Menuitem !
• How to add functionality to "Data Contract" objects?
• DataGridView and UseWaitCursor
• How to bind a DataGridViewComboBoxColumn?
• Binding CompboBox after form has loaded
• Need to Export several SQL Server Queries results to Excel