Try this...
private void Form1_Load(object sender, System.EventArgs e) {
DataTable table = ds.Tables.Add("Test"); // ds is a form's member
table.Columns.Add(new DataColumn("Test", Type.GetType("System.String")));
}
private void button1_Click(object sender, System.EventArgs e) {
ds.Tables[0].Columns[0].ColumnName = textBox1.Text;
}
Regards,
--
Angel J. Hernández M
MCSD
"Aaron" <wu****@hotmail.com> escribió en el mensaje
news:O6**************@TK2MSFTNGP11.phx.gbl...
How to convert text from the textboxes to datatable column names?
"Aaron" <wu****@hotmail.com> wrote in message
news:eX****************@TK2MSFTNGP10.phx.gbl... Hello,
I have six textboxes that there text needs to be transferred to be
datatable column names.
I have tried 2 ways
1st way
private void txtFine1_TextChanged(object sender, System.EventArgs e)
{
dcFine1.ColumnName = txtFine1.Text;
as well this variation dtVolID.dcFine1.ColumnName = txtFine1.text;
}
2nd way
dcFine1.ColumnName = txtFine1.text; and txtFine1.text.tostring();
during the creation of the datatable--I knew it was a total long shot
approach.
TIA
Aaron