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

Access uncommited row in datagrid

Status
Not open for further replies.

marcusmco

IS-IT--Management
Oct 9, 2006
30
0
0
AU
Hello,

I wonder how to access the values of a row in a datagrid that has not yet been committed to the dataset set it is bound to (the user hasn't moved the cursor away from the row yet)?

All I get when I am trying to access e.g. a specifik cell is the value from before the user started editing the row...

Cheers,
Marcus
 
when are you trying to access this row? when they are tabbing between the cells? or from within a thread? I am not sure where you would be trying to get at data that probably doesnt exist yet.

Thanks,


-The answer to your problem may not be the answer to your question.
 
Hi Marcus,

try

Dim instance As DataGridViewCell
Dim returnValue As Object
Dim rowIndex As Integer
Dim context As DataGridViewDataErrorContexts

rowIndex = Me.DataGridView1.CurrentRow.Index
instance = DataGridView1.CurrentCell
returnValue = instance.GetEditedFormattedValue(rowIndex, context)


Regards,
Noel.
 
Code:
    Private Sub dgDataGrid1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgDataGrid1.CellContentClick
        '*** If user clicks on the column or row headers, ignore and exit ***
        If (e.ColumnIndex < 0) Or (e.RowIndex < 0) Then
            Exit Sub
        End If

        '*** If user clicks on the "EDIT" button, proceed to View/Edit screen ***
        If (e.ColumnIndex = 0) Then
            ViewGUID = dgDataGrid1.Rows.Item(e.RowIndex).[b]Cells(1)[/b].Value.ToString.Trim
            ViewQuoteNumber = dgDataGrid1.Rows.Item(e.RowIndex).[b]Cells(4)[/b].Value.ToString.Trim
            ViewSerialNumber = dgDataGrid1.Rows.Item(e.RowIndex).[b]Cells(6)[/b].Value.ToString.Trim
            ViewProductionPlant = dgDataGrid1.Rows.Item(e.RowIndex).[b]Cells(8)[/b].Value.ToString.Trim
            Console.Write("Preparing to View/Edit: " & ViewGUID & " - " & ViewSerialNumber & " - " & ViewProductionPlant & vbCr)
            Me.Hide()
            frmViewEdit.Show()
            My.Application.DoEvents()
        End If
    End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top