Discussion Locked

Datagrid buttons

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

using the visual basic control "datagrid" how do i use the datagrid_buttonclicked() event to drop down another datagrid containing values that will be place on the cell where the button was clicked?
a funtionality similar to access table wherein a certain field has a "lookout" query.

3 replies

by sl-campbell

An automatic list doesn't exist. Only a button is created. The rest you have to do.

Add the button:
DataGrid1.Columns(0).Button = True
Add a listbox or dropdown list to the form and set its' visible property to false.

In the Button_Click event:
If DataGrid1.Col = 0 Then

'Fill the list with the data you want (you can also do this prior or use a bound list box)

'Then, find the position and height of the current cell:

myList.Left = DataGrid1.Columns(DataGrid1.Col).Left
myList.Left = DataGrid1.Columns(DataGrid1.Col).Left
myList.Top = DataGrid1.Top + DataGrid1.RowTop(DataGrid1.Row) + DataGrid1.RowHeight

'Then set the list width and height to the desired values

'Now make the list visible and set the focus on it:
myList.Visible = True
myList.SetFocus

End If

Now, you need to add code to the myList_Click event to capture the selection and then set the list's Visible property to False again.

This discussion is closed to new replies.