displaying drop down in a dbgrid control

How do i correctly allign the listbox to show a dropdown in the dbgrid (ButtonClick event)? It is possible to do show it using the Rowheight property but alligning it presicely is a problem. Any suggestions?
pratishAsked:
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.

aleshCommented:
You might find it difficult doing this. I suggest using a 3rd party OCX, like True DBGrid from Apex SC.
You have to take in consideration, what if the user has large fonts display settings and small fonts display settings. Use twixperpixel(x,y).
More I can't think of.

I hope this will help you. I didn't post it as an answer since I do not belive it is!

Alesh
0
vettrangerCommented:
This example uses a list box, but you can replace the name of the list control with a combobox to achieve the same result :

Replace grdCensus with your grid control name.

First in the click command of the list/combo control :

Private Sub DBList1_Click()

grdCensus.Col = 2 'replace with the column you need
grdCensus.Text = DBList1.Text
grdCensus.SetFocus
grdCensus.Col = 3 'the next col you want to have focus
DBList1.Visible = False

End Sub

In the RowColChange event of your grid :

With grdCensus
'in the code below replace 2 with your column #
    If .Col = 2 And .Text = "" Then
       DBList1.Left = .Left + .Columns(2).Left
       DBList1.Top = .Top + (.Row * .RowHeight) + SSTab1.Top
'the line below makes sure the list isn't being shown off
'the bottom of the screen. You'll need to adjust the value
'3600 as needed depending on your forms size and position
       If DBList1.Top > 3600 Then DBList1.Top = 3600
       DBList1.ZOrder 0
       DBList1.Visible = True
       DBList1.SetFocus
    Else
       DBList1.Visible = False
    End If
end with

0

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
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.