Question Datagridview column trick

tqmd1

Well-known member
Joined
Dec 5, 2009
Messages
60
Programming Experience
Beginner
Find Value from Table

Dear Developers

SQL, Table1 has data as following

Code------product
1-----------Mango
2-----------Potato
3-----------Orange

Datagridview has THREE columns as

Code----product-------qty

I have following codes
VB.NET:
str3 = "SELECT product FROM table where code =" & Val(DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(0).Value)
        dt3 = GetTable3(str3)

        If dt3.Rows.Count > 0 Then
            DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(1).Value = (IIf(IsDBNull(dt3.Rows(0).Item("product")), "", dt3.Rows(0).Item("product")))
                    Else
            MsgBox("Code Not Found", MsgBoxStyle.Information)
        End If

If code not found then msgbox appears and cursor moves to NEXT COLUMN.
that works fine.

But I want.....
When code not found then cursor MUST NOT GO TO NEXT COLUMN.

Should I change code or choose some other datagridview event?

Please help
 
Considering you don't tell us which event you are using to begin with, we can't really advise you on which event would be better to use or help you with this particular event.
 
Back
Top