Dim idcoloumn As New DataColumn
Dim id1coloumn As New DataColumn
Dim dt As New DataTable
Dim dr As DataRow
Dim dr1 As DataRow
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
idcoloumn = New DataColumn("id", Type.GetType("System.Int32"))
id1coloumn = New DataColumn("id1", Type.GetType("System.String"))
dt.Columns.Add(idcoloumn)
dt.Columns.Add(id1coloumn)
dr = dt.NewRow()
dr = dt.NewRow()
dr("id") = 12
dr("id1") = 12
dr1 = dt.NewRow()
dr1("id") = 13
dr1("id1") = 13
dt.Rows.Add(dr1)
DataGridView1.DataSource = dt
Return
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim j As Integer
Dim p As Integer
'Dim temp As Integer
Dim ds As New DataSet
i = 0
For p = 0 To dt.Rows.Count - 1
'Next
i = i + dt.Rows(p)("id")
'j = ds.Tables(0).Rows(0).Item("id1").ToString()
'temp = i + j
Next p
TextBox1.Text = i.ToString()
End Sub
End Class
No comments:
Post a Comment