How do u get all the data at the same row in the datagrid? RRS feed

  • Question

  • I need to get data from my datagrid to validate the information i have in my SQL2000 and the language i using is 2003

    I need to get data from the whole row. Somebody save me!!
    Thxs for any1 who replys^_^ 
    Thursday, September 25, 2008 9:02 AM


  • Try this.

    Public Class Form1 
        Dim dt As New DataTable 
        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click 
            For i As Integer = 0 To dt.Rows.Count - 1 
                MessageBox.Show(DataGrid1.Item(i, 0).ToString) 
        End Sub 
        Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load 
            For i As Integer = 0 To 11 
                Dim dr As DataRow = dt.NewRow 
                dr.Item(0) = i 
                dr.Item(1) = "name" & i.ToString 
            DataGrid1.DataSource = dt 
        End Sub 
    End Class 

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Xingwei Hu Friday, October 3, 2008 3:13 AM
    Thursday, October 2, 2008 7:35 AM