Thanks guys!
I actually tried both ways. But I'm still getting an error, although a diffrent error. And that is "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"
So, .SelectedCells(2) would mean the selected cells in Column 2. Is that right? It's like it's not grabbing my new value I'm typing in the datagrid. So if I type a new value at row 4, column 2. That should go over. But I don't think it is. I know it's something I'm doing wrong.
Any thoughts? I'll keep plugging!
Thanks!
I want to add on to this. So here is my new code.
CODE
Dim constr As New SqlConnection(PVDBConn)
MsgBox(Me.dgVisTbl.SelectedCells(0).Value.ToString)
Try
cmdUpd = New SqlCommand("updVisName", constr)
cmdUpd.CommandType = CommandType.StoredProcedure
cmdUpd.Parameters.Add("@VisName", SqlDbType.NVarChar).Value = (Me.dgVisTbl.SelectedCells(0).Value.ToString)
cmdUpd.Parameters.Add("@VisID", SqlDbType.Int).Value = (Me.dgVisTbl.SelectedCells(0).Value.ToString)
constr.Open()
cmdUpd.ExecuteNonQuery()
constr.Close()
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
The other I got was because I had .SlectedCells(2) on the visname. Nowif I run it with that MsgBox(Me.dgVisTbl.SelectedCells(0).Value.ToString). That tells me I'm reading the value properly. But then I get this error,
"Failed to convert parameter from a string to a int32" First of all, I'm changing the vis name, which is a nvarchar type, not a int.
Second of all, I'm still confused what the (0) stands for in selected cells.
Thanks again!
Rudy
This post has been edited by RudyVB.net: 9 May, 2008 - 01:30 PM