|
-
Jun 20th, 2007, 07:24 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] populating drop down list of a datagrid column
is this possible?
i have a datagrid with 2 columns... lets say col1 and col2.. in col2, i have a drop down button which is supposed to list all valid values for it. sorta like list of values.
any ideas?
-
Jun 20th, 2007, 12:02 PM
#2
Re: populating drop down list of a datagrid column
You must supply another control that contains the list of values. When the button is clicked move the control into position, make it visible and give it focus. When the user selects a value, write the value to the grid cell, hide the control and put focus back onto the grid control.
This sample code uses a ListBox placed just below the current cell.
Code:
Private Sub DataGrid1_ButtonClick(ByVal ColIndex As Integer)
Dim lngLeft As Long
Dim lngTop As Long
lngLeft = DataGrid1.Left + DataGrid1.Columns(ColIndex).Left
lngTop = DataGrid1.Top + DataGrid1.RowTop(DataGrid1.Row) + DataGrid1.RowHeight
List1.Move lngLeft, lngTop, DataGrid1.Columns(ColIndex).Width
List1.Visible = True
List1.SetFocus
End Sub
Private Sub List1_Click()
DataGrid1.Columns(2).Text = List1.Text
List1.Visible = False
DataGrid1.SetFocus
End Sub
-
Jun 24th, 2007, 07:37 PM
#3
Thread Starter
Hyperactive Member
Re: populating drop down list of a datagrid column
thanks... this seems to work.. just hope it is as easy as in vb.net because i've decided to use vb.net instead of vb6 for my database application.
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
|