Tuesday, May 5, 2009

how to populate MS Flex Grid in vb 6.0 through code?

I want to use MS Flex Grid instead of DataGrid. how to load records in the MS Flex Grid ??? need the sample code.

1 comment:

  1. Follow these steps.
    i suppose my flex grid name is grd

    private sub GrdHead()

    With Grd
    .rows=1
    .cols=2

    .row=0

    .col=0
    .colwidth(0)=1000
    .text="ID"

    .col=1
    .colwidth(1)=1500
    .text="Name"

    End with

    End sub


    private sub GrdData()
    dim r as integer
    r=1

    do while not recordset.eof
    r=r+1
    With Grd
    .rows=r

    .row=r-1

    .col=0
    .text=recordset!1stFieldName

    .col=1
    .text=Recordset!2ndFieldName

    End with

    Recordset.Movenext

    loop

    End sub

    now call these two sub routines as

    Call GrdHead
    Call GrdData


    ' i think this will work for you.

    ReplyDelete