Hi,
How can add 4 rows and 6 columns into MsFlexGrid1 with Command_click event in VB6?
Thanks

Recommended Answers

All 3 Replies

hi,

Simply you like to add rows and columns means you can use below code otherwise explain clearly what is ur need.

Private Sub Command1_Click()
     MSFlexGrid1.Rows = 4
     MSFlexGrid1.Cols = 6
End Sub

Shailaja:)

Hi,
How can add 4 rows and 6 columns into MsFlexGrid1 with Command_click event in VB6?
Thanks

Hi,
Ok we have done it. Now, code below adds rows and columns but, they are all empty. I want to add "Hello" into all cells. How do i do that?

I just want to populate the msflix. That's all.

Dim row, column, x, y
    row = Adodc1.Recordset.RecordCount
    column = Adodc1.Recordset.Fields.Count
    
    For x = 0 To row
        MSFlexGrid1.Rows = x
            For y = 0 To column
                MSFlexGrid1.Cols = y
            Next y
    Next x

Thanks

Done it. Example

Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset
    rst.CursorLocation = adUseClient
    rst.Open "Select * from u_translations", Adodc1.ConnectionString, adOpenStatic, adLockReadOnly
    With MSFlexGrid1
        .Rows = rst.RecordCount + 1
        .Cols = rst.Fields.Count + 1
        .Row = 1
        .Col = 1
        .RowSel = .Rows - 1
        .ColSel = .Cols - 1
        rst.MoveFirst
        .Clip = rst.GetString(adClipString)
    End With
    rst.Close
    Set rst = Nothing
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.