|
-
May 11th, 2010, 07:58 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Datagridview on cell leave Refresh problem
I want to send the data that i just entered into a cell to an If-statemens to perform certain functions.
I an using the following code just for testing purposes:
1 Code:
Private Sub DGVReceipt_CellLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGVReceipt.CellLeave
Dim row, cell As Integer
row = e.RowIndex
cell = e.ColumnIndex
Dim a As String
a = DGVReceipt.Item(cell, row).Value
End Sub
Now I find that the value I entered into the cell doesn't display. Only when i go back to the cell and leave it again will it display.
How can I get the value to display immediately?
-
May 11th, 2010, 09:21 PM
#2
Re: Datagridview on cell leave Refresh problem
I don't see how that code can do anything useful. You assign the cell value to a local variable that immediately loses scope. You aren't changing anything.
-
May 12th, 2010, 01:51 AM
#3
Thread Starter
Addicted Member
Re: Datagridview on cell leave Refresh problem
I played with the code some more and got it to do what i wanted.
vb Code:
Private Sub DGVReceipt_CellLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGVReceipt.CellLeave Dim row, cell As Integer row = e.RowIndex cell = e.ColumnIndex DGVReceipt.CommitEdit(DataGridViewDataErrorContexts.Commit) Dim strNewValue As String strNewValue = DGVReceipt.Item(cell, row).Value Dim totrows As Integer = DGVReceipt.Rows.Count - 1 Select Case cell Case Is = 0 And row < totrows '\\\\ CATEGORY Case Is = 1 And row < totrows '\\\\ STOCK If DGVReceipt.Item(cell, row).Value = "-- Add New --" Then frmNewStock.ShowDialog() STOCK_DROPMENU() End If Case Is = 2 And row < totrows '\\\\ ESTATE End Select End Sub
-
Aug 31st, 2011, 02:49 AM
#4
New Member
Re: [RESOLVED] Datagridview on cell leave Refresh problem
Hello guys!
I am facing similar kind of problem with the Datagridview, I am trying to validate a certain column, and when I check on a value right after I leave the cell, I am not getting the current value, any pointers on this?
--Vatsa
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|