|
-
Mar 17th, 2005, 10:17 AM
#1
Thread Starter
Lively Member
2 Listboxed populating FlexGrid [Resolved]
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
Last edited by RyanEllis; Mar 17th, 2005 at 10:38 AM.
-
Mar 17th, 2005, 10:30 AM
#2
Re: 2 Listboxed populating FlexGrid
VB Code:
Private Sub lstSource_Click()
If lstSource.ListIndex >= 0 Then
lstDest.ListIndex = -1
End If
End Sub
Private Sub lstDest_Click()
If lstDest.ListIndex >= 0 Then
lstSource.ListIndex = -1
End If
End Sub
-
Mar 17th, 2005, 10:36 AM
#3
Thread Starter
Lively Member
Re: 2 Listboxed populating FlexGrid
Thanks,
Worked Perfect, a lot easier to do than i though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|