4
Answers

Adding line to datagridveiw from textbox

Ask a question
Marvin kakuru

Marvin kakuru

13y
1.3k
1
hi there,
your all ok i hope. Gat stuck been trying to add lines to my datagridview from various textboxes. just like you add an item to a shoping basket, but every time i click my button i only replace what i had already entered with what is in my textboxes.

any help below is the code i am using


}
DataTable dt = new DataTable();
dt.Columns.Add = ("DAY",typeof(string));
DataRow DR = dt.NewRow();
DR["Day"] = textbox1.Text.Tostring();
dt.Rows.Add(DR);
dataGridView1.Datasource=dt;
}

thanks

Answers (4)