VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Review Data From Data grid, In Easiest Way.

by Gehan Fernando (47 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Thu 15th March 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Review Data From Data grid, In Easiest Way.

Rate Review Data From Data grid, In Easiest Way.




    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Call LoadItems()

    End Sub

    Private Sub LoadItems()

        For ForCount As Integer = 1 To 10
            DataGridView1.Rows.Add()
            Dim Row As Int16 = DataGridView1.Rows.Count

            DataGridView1.Rows(Row - 1).Cells(0).Value = ForCount
            DataGridView1.Rows(Row - 1).Cells(1).Value = ForCount & " Name And ForCount"
        Next

    End Sub

    Private Sub DataGridView1_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellDoubleClick

        If DataGridView1.Rows.Count = 0 Or DataGridView1.CurrentRow.Index < 0 Then
            Exit Sub
        Else
            TextBox1.Text = DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(0).Value.ToString()
            TextBox2.Text = DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(1).Value.ToString()
        End If

    End Sub

End Class


Download this snippet    Add to My Saved Code

Review Data From Data grid, In Easiest Way. Comments

No comments have been posted about Review Data From Data grid, In Easiest Way.. Why not be the first to post a comment about Review Data From Data grid, In Easiest Way..

Post your comment

Subject:
Message:
0/1000 characters