sriviji 0 Newbie Poster

Hi,
Dim MyDT As New DataTable
Dim MyRow As DataRow
MyDT.Columns.Add(New DataColumn("Item", GetType(Int32)))
MyDT.Columns.Add(New DataColumn("Quantity", GetType(Int32)))
MyDT.Columns.Add(New DataColumn("Price", GetType(Int32)))
MyDT.Columns.Add(New DataColumn("Total", GetType(Int32)))
MyDT.Columns.Add(New DataColumn("InvoiceNo", GetType(Int32)))

MyRow = MyDT.NewRow()
MyRow(0) = TextBox1.Text
MyRow(1) = TextBox2.Text
MyRow(2) = TextBox3.Text
MyRow(3) = TextBox4.Text
MyRow(4) = TextBox5.Text
MyDT.Rows.Add(MyRow)
Dim i As Integer

DataGridView1.DataSource = MyDT

TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""


i have code like ths ..My prblem is i have textbox i an getting values from that textbox and first time it displays in grid but after entering 2 nd value in txtboxes it overwrites the datagrid not append and disply...

wenever i add the datas in txtbox and enter it should add datagrid one by one ..

Pls tell how to do that is there any loop operatinos

I dont knw how to do

Rep ASAP

Krishna

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.