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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid CurrentRowIndex problem

Status
Not open for further replies.

myrgir

Programmer
Feb 7, 2006
62
CA
Hi I have a problem with my datagrid. When I click on the second record in my datagrid the focus always go back to the first record in it.
here is my code and the line with "**" is where the currentRowindex change from 1 to 0

Code:
TempNoLine = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 4)
TempNoLineRev = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 5)
TempFilter = ""
TempFilter += "isdeleted = 0 And job_Seq = " & Me.JobNumber.Text & _
" and created_by = '" & Me.lbCreatedBy.Text & _
"'and Job_Line = " & TempNoLine & "and Job_LineRev =" & TempNoLineRev
If TempNoLine <> 9999 Then
  **m_DataLayer.DvJobItem.RowFilter = TempFilter
...
 
solution:
Code:
Dim DvJobItemTemp As DataView
Dim DsJobItemTemp As DataSet

m_DataLayer.DvJobItem = m_DataLayer.DsJobItem.Tables("Job_item").DefaultView

If m_DataLayer.DvJobItem.Count > 0 Then
    DsJobItemTemp = m_DataLayer.DsJobItem.Copy
    DvJobItemTemp = DsJobItemTemp.Tables("job_item").DefaultView
     TempNoLine = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 4)
     TempNoLineRev = Me.DataGrid1.Item(Me.DataGrid1.CurrentRowIndex, 5)
     TempFilter = ""
     TempFilter += "isdeleted = 0 And job_Seq = " & Me.JobNumber.Text & _
     " and created_by = '" & Me.lbCreatedBy.Text & _
     "'and Job_Line = " & TempNoLine & "and Job_LineRev =" & TempNoLineRev
      If TempNoLine <> 9999 Then
         DvJobItemTemp.RowFilter = TempFilter
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top