I have 2 Listboxes, a datagrid with 2 colums and an add button on a form.
I want it when a item on the 1st listbox(source) is clicked and the add button is pressed, it gets added to the first column in the flexgrid. When an item from the second listbox(destination) is clicked and the add button is pressed it will add the item to the second column in the flexgrid.
I have that working alright, but i want it so that only 1 listbox can be clicked. Right now it is possible to have 1 item from the 1st listbox selected while one item from the second listbox is also selected. I want it so that only 1 listbox can have items click on it at 1 time, but be able to switch back and forth.
Heres the code i have so far.
VB Code:
Private Sub cmdAdd_Click() If lstDest.ListIndex <> -1 Then lstSource.ListIndex = -1 Item = lstDest.Text If grdFields.TextMatrix(0, 1) = "" Then dGridRow = 0 grdFields.TextMatrix(dGridRow, 1) = Item Else dGridRow = dGridRow + 1 grdFields.TextMatrix(dGridRow, 1) = Item End If End If If lstSource.ListIndex <> -1 Then lstDest.ListIndex = -1 Item = lstSource.Text If grdFields.TextMatrix(0, 0) = "" Then sGridRow = 0 grdFields.TextMatrix(sGridRow, 0) = Item Else sGridRow = sGridRow + 1 grdFields.TextMatrix(sGridRow, 0) = Item End If End If End Sub
-Ryan




Reply With Quote