-
help
i tried but it doesn't work
Code:
Private Sub MoveCombo()
' In case of error, hide the ComboBox.
On Error GoTo Error_Handler
Dim gcol As MSDataGridLib.Column
Set gcol = DataGrid1.Columns(DataGrid1.col)
If gcol.Caption = "fieldname" And DataGrid1.CurrentCellVisible Then
' Move the ComboBox inside the column
' if it is the current column and it is visible.
combo1.Move DataGrid1.Left + gcol.Left, _
DataGrid1.Top + DataGrid1.RowTop(DataGrid1.row), gcol.Width
combo1.ZOrder
combo1.SetFocus
DataGrid1.RowHeight = combo1.Height
combo1.Text = gcol.Text
Exit Sub
End If
Error_Handler:
' In all other cases, hide the ComboBox.
combo1.Move _10000
If DataGrid1.Visible Then DataGrid1.SetFocus
End Sub
on the combobox
Private Sub combo1_Click()
' Change the value of the underlying grid cell.
DataGrid1.Columns("fieldname").Value = _
combo1.ItemData(combo1.ListIndex)
End Sub
then add the sub on the ff events of the datagrid
Private Sub DataGrid1_RowColChange(LastRow As Variant, _
ByVal LastCol As Integer)
MoveCombo
End Sub
Private Sub DataGrid1_RowResize(Cancel As Integer)
MoveCombo
End Sub
Private Sub DataGrid1_ColResize(ByVal ColIndex As Integer, _
Cancel As Integer)
MoveCombo
End Sub
Private Sub DataGrid1_Scroll(Cancel As Integer)
MoveCombo
End Sub
Private Sub DataGrid1_SplitChange()
MoveCombo
End Sub
-
1 Attachment(s)
Re: help
i attached class module, how to use it correctly?
why it didn;t work? what's missing?
Code:
Private Sub DataGrid1_MouseMove(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
Dim a As ComboWithGrid
Set a = New ComboWithGrid
a.SetComboOnGrid Combo1, DataGrid1, 1, True
End Sub
-
Re: help
can you tell what doesnt work please?
What does this code do?
Whats the Error?
:confused:
:wave:
-
Re: help
"It doesn't work" doesn't mean anything. We need specifics.
What is it doing and what should it be doing?
-
Re: help
the class module will integrate combobox in a datagrid column
the sub setComboOnGrid function is the key
the am i calling the procedure is it correct?
-
Re: help
See this
http://codeguru.earthweb.com/forum/s...75&postcount=7
http://codeguru.earthweb.com/forum/s....php?p=1699207
:wave:
BTW the member who made the post is still there. Try PM him on that forum. Or post a new thread there.