I have 1 gridview with big table...colums:k,mi,ib and 3 textbox...texbox1 is first column,textbox2 is second and textbox3 is third! I want when i type some number in textbox1(That number is K),i want to textbox2 and textbox3 give me value of mi and ib in same row as k...but i got this error!

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

            With GridView1
            For i As Integer = 0 To .Rows.Count - 1
                If LCase(.Rows(i).Cells("K").ToString) = LCase(TextBox1.Text) Then
                    TextBox2.Text = .Rows(i).Cells("mi").ToString
                    TextBox3.Text = .Rows(i).Cells("ib").ToString
                    Return
                End If
            Next
        End With
    End Sub

Recommended Answers

All 2 Replies

You've got to refer to the cells by their numeric index.

.cells(0) is k for example.

@madCoder

But from textbox1 i get value for cells...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.