Results 1 to 2 of 2

Thread: DATGRID WITH COMBO BOX

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2000
    Posts
    19
    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

  2. #2
    Junior Member
    Join Date
    Jan 2000
    Location
    Leeds
    Posts
    30
    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
    The early bird gets the worm, but the second mouse gets the cheese.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width