|
-
Feb 20th, 2010, 07:10 PM
#1
Thread Starter
New Member
VB 2008 - problem updating datagridview
Hello everyone,
I'm stuck on a stupid problem
I have a datagridview where i add rows using array like this:
Dim srow() As String = {getIDprodus(cmbprodus.Text), cmbprodus.Text, getprodusforma(cmbprodus.Text), txtcantitate.Text}
griddetalii.Rows.Add(srow)
Next, i need to let user to modify the added row. So when user selects a row and press EDIT, a new form is popped out using this code:
Dim i = griddetalii.CurrentRow.Index
frmdetaliiiesire.cmbprodus.Text = griddetalii.Item(0, i).Value
frmdetaliiiesire.txtcantitate.Text = griddetalii.Item(1, i).Value
frmdetaliiiesire.StartPosition = FormStartPosition.CenterScreen
frmdetaliiiesire.ShowDialog()
In that form, the user can change the 2 values and after that, he clicks ok with this code:
frmiesiri.griddetalii.Rows(CInt(TextBox1.Text)).Cells(0).Value = cmbprodus.Text
frmiesiri.griddetalii.Rows(CInt(TextBox1.Text)).Cells(1).Value = txtcantitate.Text
In textbox1 i have put the index of the current row selected in grid
The problem is when i push OK, the applications crashes and i receive an error: INDEX WAS OUT OF RANGE
If the users changes the values from the same form, it's works. But changing them from another form crashes the applications
Can someone help me?
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
|