Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The datagrid jump lines

Status
Not open for further replies.

makisbest

Technical User
Mar 3, 2005
125
GR
hi all

I have this code to move down with my datagrid.
All things is going fine whene for a reason
the grid is starting jumping lines without reading the line saing in the i loop.

k = DataGrid1.ApproxCount
For i = 0 To k Step 1
DataGrid1.Row = i
code = DataGrid1.Text
DataGrid1.Col = 1
result = chkdigit(DataGrid1.Text)
final1 = DataGrid1.Text & result
Print #1, code, final1
DataGrid1.Col = 0
Next

any help
 


The .Row Method/Property is basically for the Visible Rows only. It depends on the Cursor used, and if it is fully populated or not.

It is better to use the Grid's recordset for things like this:

Do Until rs.EOF
'Do something
rs.MoveNext
Loop

or, if the cursor type is Static or a Keyset

'Fully populate the recordset
rs.MoveLast
rs.MoveFirst

Dim i As Long
for i=1 to rs.Recordcount
rs.MoveFirst
rs.Move i

next i

If using the ADODC then:
Dim rs As ADODB.Recordset
Set rs = ADODC.Recordset

If you do not want the Grid data to be affected with the recordset movement, then use a recordset Clone, if supported:

Set rs = ADODC.Recordset


And, If the recordset supports BookMarks, you can position the current grid row to the recordset clone position using:


DataGrid1.BookMark = rsclone.Bookmark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top