Help with VB6 Datagrids


I wrote a program to manage some data, and am using datagrids. I am manually setting the datasource for the datagrid at runtime instead of using the "properties" method and retrieving the feilds. It helps the program run faster, and allows me to manipulate the datagrid easier, but it also has become a bit more difficult for me to program.

Is there a way to format a datagrid column, so when you click on the cell in that colum, it gives you say a drop down menu. Perhaps if I have a boolean value of yes and no only, how do I program it so that when a user clicks in the datagrid, they only have a choice of yes or no. I know I can do that by right clicking the datagrid, retreiving the fields, and then going to the format tab, and setting the dataformat of each column, but how do I program that at runtime.


If PlanField.State = adStateOpen Then
End If

With PlanField
.ActiveConnection = PlanDB
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = "SELECT * FROM PlanField WHERE Series = '" & ComboSeries.Text & "' AND Number = '" & ComboNumber.Text & "'"
End With

Set dgField.DataSource = PlanField
Label8.Caption = PlanField.RecordCount
'--------------------- Format Datagrid ----------------------
Function DG_FormatField()

With dgField
.AllowAddNew = False
.AllowDelete = False
.AllowUpdate = False
.AllowRowSizing = False
.Columns(0).Visible = False
.Columns(1).Visible = False
.Columns(2).Visible = False
.Columns(3).Alignment = dbgCenter
.Columns(4).Alignment = dbgCenter
.Columns(5).Alignment = dbgCenter
.Columns(6).Alignment = dbgCenter
.Columns(7).Alignment = dbgCenter
.Columns(8).Alignment = dbgCenter
End With

End Function

This is what I have to set the datasource, and to format the datagrid, but there is no command for:
.Columns(6).Format(yada yada yada)
can anyone please help me with the appropriate method to work this out?

The darthmoob.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!