Datagrid button

How do I associate a combobox with a button in a datagrid cell and then populate it?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rdolivawAuthor Commented:
Edited text of question.
There is no built in drop down box within the dbgrid.  After you have set the button to be visible, you have to put some code behind the button click event to show your own list.  Below is a quick example.  This is pretty basic, and you will have to play with certain events to get it to work exactly like you want.  Hope this help.

Create a form with a data control, list box, and a dbgrid.  Set the lists and data controls visible poperty to false.  Add some data to the list control.

*******BEGIN CODE**********
Option Explicit
Dim intColIdx As Integer 'This will contain the index for the current cell in the dbgrid
Dim blnListShow As Boolean 'is the list showing or not

Private Sub DBGrid1_ButtonClick(ByVal ColIndex As Integer)
    Dim intTop As Integer
    intColIdx = ColIndex
    If blnListShow = False Then 'if the list is not showing then...
        blnListShow = True
        List1.Left = DBGrid1.Columns(ColIndex).Left + 360
        intTop = DBGrid1.Top + (DBGrid1.RowHeight * (DBGrid1.Row + 2))
        List1.Top = intTop
        List1.Width = DBGrid1.Columns(ColIndex).Width + 15
        List1.Visible = True
    Else 'if the list is show, hide it
        blnListShow = False
        List1.Visible = False
    End If
End Sub

Private Sub Form_Load()
blnListShow = False 'initialize
End Sub

Private Sub List1_Click()
    DBGrid1.Columns(intColIdx).Text = List1.Text 'set the value of the dbgrid
    List1.Visible = False 'hide the list
End Sub

Private Sub List1_LostFocus()
    blnListShow = False
    List1.Visible = False
End Sub
*********END CODE***********************


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rdolivawAuthor Commented:
Thanks a bunch!  This is much clearer than the other responses to similar questions in the archive.  I think this'll work.

R. Daneel
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.