borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Create field AutoNumber?)Next Topic (Null Record) New Topic New Poll Post Reply
AndreaVB Forum : Database : buttons/dropdown on Datagrid 6.0
Poster Message
TechHead
Level: Guest


icon buttons/dropdown on Datagrid 6.0

Has anyone tried using the or putting a dropdown on one of the columns of the Datagrid? I seem to have a problem putting a list of selection under a particular column.

----------------------------------------------------
Name      |    Address     |           Sex           |
----------------------------------------------------
Name1    | Address here |          MALE          |
----------------------------------------------------
Name2    | 2nd Address  |        FEMALE         |
----------------------------------------------------


The "SEX" column needs to be in drop down so the user can just select one of the choices. I can enabled the button from the Datagrid properties but that's it.  Its a total as I can't fill any item on it. Anyone has the idea I thank you in advance.  

[Edited by TechHead on 08-03-2004 at 11:45 PM GMT]

08-03-2004 at 03:44 PM
| Quote Reply
GdaGuy
Level: Trainee

Registered: 20-10-2005
Posts: 1
icon Re: buttons/dropdown on Datagrid 6.0

Public WasVisible As Boolean

Public Sub SynchCombo()
'Forget the button property.
'Use a regular combo box and this code to synchronize the position of the combo box with the grid column and row
'call this procedure in the RowColChange and Scroll procedures
'you might have to make a few adjustments, I have'nt exhausted the testing
Dim ComboColumn As Long
On Error Resume Next
ComboColumn = 2 'the column index of the column you're trying to do the dropdown for.
RegularCombobox.Visible = (DataGrid.Col = ComboColumn)
WasVisible = (DataGrid.Col = ComboColumn)
If DataGrid.Columns(ComboColumn).Left <= 0 Or DataGrid.RowTop(DataGrid.Row) <= 0 Then
If RegularCombobox.Visible = True Then
  WasVisible = True
  RegularCombobox.Visible = False
End If
Else
If RegularCombobox.Visible = False And WasVisible = True Then
  RegularCombobox.Visible = True
End If
RegularCombobox.Left = DataGrid.Left + DataGrid.Columns(ComboColumn).Left
RegularCombobox.Top = DataGrid.Top + DataGrid.RowTop(DataGrid.Row)
End If
RegularCombobox.Width = DataGrid.Columns(ComboColumn).Width
RegularCombobox = DataGrid.Columns(ComboColumn).Text
If DataGrid.Col = ComboColumn Then RegularCombobox.SetFocus
End Sub

20-10-2005 at 08:59 PM
View Profile Send Email to User Show All Posts | Quote Reply
newbie_1020
Level: Master


Registered: 29-11-2005
Posts: 117
icon Re: buttons/dropdown on Datagrid 6.0

hi..viewed your post..nice trick

____________________________
united we stand,divided we stand alone...

16-12-2005 at 03:18 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : buttons/dropdown on Datagrid 6.0
Previous Topic (Create field AutoNumber?)Next Topic (Null Record) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder