add item value to listbox from datagrid
i am putting together a program using VB.net
and i am doing most things programmatically, now here is my problem.
after imputing information from a SQL database using DataTable function into a datagrid i want on click the user is able to select a name and move it to a list box and so on. this if find the problem i am having is i want to add the item as well as assign a valuemember to it. so that when the user update a new table with that from the listbox only the valuemember is posted and not what is displayed to the user...
here is what i have so far
[extract]
'datagrid is call lst_avail
' populating datagrid from function
Dim database_source As DataTable = update_list_to_cbox()
With Me.lst_avail
.datasource = database_source
.columns(0).DataPropertyName = "listid" ' this attib from the database
.columns(1).HeaderText ="List of Item"
.columns(1).DataPropertyName = "listname"
Now under the click button for the list box i added the following
[extract]
Dim index As Integer = lst_course_avail.CurrentRow.Index
With lst_item_sel
.Items.Add(lst_avail.Item(1, index).Value)
.ValueMember = lst_avail.Item(2, index).Value
End With
however when i do a selectvalue it doesnt give me any result, i am assuming that i need to add the value while i am adding the item however, all the command i am getting for addITEM is not being accepted
i am working with .net studio 2005
any help to do this
Why fight Information Technology when you can outsource IT