PDA

Click to See Complete Forum and Search --> : DATGRID WITH COMBO BOX


darylcollins@op2.co.uk
Apr 3rd, 2000, 10:03 PM
Greetings,

Could someone help me, trying to create a combo box within a datagrid so users so not have to type in all the time.

Thanks you in advance

pies
Apr 4th, 2000, 04:06 AM
Hi there, ok this an example of what i have been using..

It requires that the column that you want the list to appear under has it's button setting set to true, the rest should be pretty self explanitory, if you need any more info please reply again..

Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer)
Dim Co As Column
Set Co = DBGrid1.Columns(ColIndex)
'Position the listbox
List1.Left = DBGrid1.Left + Co.Left + Co.Width
List1.Top = DBGrid1.Top + DBGrid1.RowTop(DBGrid1.Row)
List1.Width = Co.Width
List1.Visible = True
List1.ZOrder 0
List1.SetFocus
End Sub

Private Sub Form_Load()
' add items to the list
List1.AddItem "On"
List1.ItemData(List1.NewIndex) = -1
List1.AddItem "Off"
List1.ItemData(List1.NewIndex) = 0
End Sub


Private Sub List1_Click()
DBGrid1.Columns("Current").Text = List1.ItemData(List1.ListIndex)
List1.Visible = False
End Sub

Piers