Help with VB6 Datagrids - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help with VB6 Datagrids

darthmoobeydarthmoobey Posts: 140Member

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.