You will need to create the data in an object that is compatible with
DataGrid.DataSource such as DataTable or DataSet.
Here is a quick example of a DataTable:
DataTable dt = new DataTable("Products");
dt.Columns.Add(new DataColumn("txtProdID", typeof(string));
dt.Columns.Add(new DataColumn("txtDesc", typeof(string));
dt.Columns.Add(new DataColumn("txtQty", typeof(int));
dt.Columns.Add(new DataColumn("txtUnit", typeof(double));
dt.Columns.Add(new DataColumn("txtTotal", typeof(double));
DataRow dr = dt.NewRow();
dr["txtProdID"] = txtProdID.Text;
dr["txtDesc"] = txtDesc.Text;
dr["txtQty"] = System.Convert.ToInt32(txtQty.Text); // this could throw a
NumberFormat exception
...
dt.Rows.Add(dr);
then go back to DataRow and add another row when the button gets pressed
again.
when finished setting up your table:
datagrid.DataSource = dt;
Alex
> Hi,
> I have a windows form using vb.net that has 5 text boxes, 1 button and a
[quoted text clipped - 14 lines]
> Thanks
> Jamie