473,388 Members | 1,524 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

DataTable columname to be textbox text

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
Nov 16 '05 #1
4 4055
What is ur question?

Regards,
--
Angel J. Hernández M
MCSD
"Aaron" <wu****@hotmail.com> escribió en el mensaje
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

Nov 16 '05 #2
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

Nov 16 '05 #3
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


Nov 16 '05 #4
Angel,

Thanks,

But were is the Dataset?

DataTable does not have .Tables.

Aaron
"Angel J. Hernández M." <an**********@hotmail.com> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
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



Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mico | last post by:
I would be very grateful for any help with the following problem: I use a DataAdapter to fill a DataSet in the Page_Load method. Later, I use this DataSet to construct a DataTable, then create...
1
by: Paul Aspinall | last post by:
Hi I have a datatable which I have linked to a combo control, via the datasource property of the combo control. I have also set the displaymember property of the combo, to ensure that my...
1
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in...
3
by: angus | last post by:
Dear All, my problem is that, i have a table to display, and, it allows the user to enter a new unit in the text box e.g. *original table (empty)*
2
by: nate axtell | last post by:
After binding a DataGrid and a few TextBoxes to the same DataTable in VB ..NET I successfully see the TextBoxes update when I change the selection in the DataGrid. I put DataGrid1.Invalidate() in...
0
by: witek | last post by:
I am lost. There is a dataTable with data which I want to dispaly in GridView. dataTable is not connected to any database. Just dataTable with data. There is a class wich is used as column...
0
by: Maart_newbie | last post by:
Hi all, I've got a question about returning the value of a pk-column to a DataTable after inserting a row (via a data-adapter) using MySql5. Here is the SQL and code concerned: ...
4
by: Tomasz Jastrzebski | last post by:
Hello Everyone, I have a GridView control bound to a plain DataTable object. AutoGenerateEditButton is set to true, Edit button gets displayed, and RowEditing event fires as expected.
1
by: gomathinayagam | last post by:
hai, am only beginer in c#... i am trying to connect database with webform. using a technique that the fields of the table and the controls in a form are named same...then i try get the controls...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.