Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check Box in DataGrid
Message
 
À
04/11/1999 12:44:19
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00279768
Message ID:
00286979
Vues:
24
>Hello, This is also my problem I face now.
>But I have no money to buy from third party, can I write it by myself?
>I have read the VB6 online help, here is the ButtonClick Event (DataGrid Control) last paragraph:
>Typically, you enable the column button when you want to drop down a Visual Basic control (such as the built-in combo box, a bound list box, or even another DataGrid control) for editing or data entry. When the button in the current cell is clicked, the ButtonClick event will be fired. You can then write code to drop down the desired control from the cell.

I found this code last week but I didn't have the chance to try it. If you try it, please be gentleman and comment it here!

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?

===============================

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
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform