Im creating a desktop application in Visual Basic 6.0 and im having trouble getting the data from datagrid.

Im used to using DataGridView commands in Visual Basic .Net but its not available in VB6.

I already tried using datagrid1.textmatrix but its not available for the datagrid controls.

I think .textmatrix is a Flexgrid control.

i know i have to use looping for this but i dont know the commands for getting the data in the data grid.

Can anyone give me an insight.. thx

Recommended Answers

All 4 Replies

I use this code to get the data from datagrid in Visual Basic .Net

Dim rows As DataGridViewSelectedRowCollection = Me.dgvArea.SelectedRows

                        For Each row As DataGridViewRow In rows

                            Dim myrow As DataRowView = CType(row.DataBoundItem, DataRowView)

                            IntAreaID = CInt(myrow(0))

                            Me.txtAreaCode.Text = myrow(1).ToString

                            Me.txtAreaName.Text = myrow(2).ToString

                            Me.txtAreaDescription.Text = myrow(3).ToString

                        Next

can someone show me the equivalent of this in VB6?

This following code to get data from datagrid..

DataGrid1.Row = 0 ' first row.. just looping as many of datagrid rows 
DataGrid1.Columns(0).Value
DataGrid1.Columns(1).Value
DataGrid1.Columns(2).Value

thx Jx_Man.. thats Exactly what im looking for.

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.