Hi all.
Using VB6:
I have an application in which I am programmatically populating a datagrid.
When I first drop the datagrid on my form, it has 2 columns by default.
I can add further columns to them but I wanted to know if there was a tidy way of starting from column 1 to begin with, or do I just have to delete the first two columns and start again?

This is (pretty much) my column definition loop

For Each Col In RsDivisions.Fields

    Set c = DataGridDiv.Columns.Add(DataGridDiv.Columns.Count)
    With c
      .Visible = True
      .Width = 1000
      .Caption = Col.Name
      .Alignment = dbgRight
    End With

Next

Just start over. It would be easier . Less problem.

I wanted to know if there was a tidy way of starting from column 1 to begin with

Remove one column when form load.

Private Sub Form_Load()
    DataGrid1.Columns.Remove 0
End Sub

Thanks guys.
I am getting the impression that the DataGrid component wasn't really designed to be used in this way.

If you think your problem is solved .. mark this as solved .. :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.