|
-
July 9th, 2008, 08:30 AM
#1
Table - How to?
Hi all!
How can I create a table, which has 3 columns? The first column contains a number, the second one contains a datetime field, and the third one contains a text.
In my app there will be a form that I will fill in order to add some new lines at this table.
This table will appears when I press a button at my app. I will not use any kind of database system. I would like to store all data in memory.
Someone could help me to create and store some data in it?
Thank you in advance!
-
July 9th, 2008, 09:00 AM
#2
Re: Table - How to?
we will not do your homework for you.
-
July 9th, 2008, 09:14 AM
#3
Re: Table - How to?
I think you should be a little bit more polite.
If you know a good tutorial send me the link, that I can do it by myself. If I sent a question to this forum, it is because I am a beginner in C#, and I searched at the internet and I didn't find anything useful.
I didn't ask to anyone do my job. I only give to the forums members all details that I think it can be relevant.
I will not waste my time replying you.
So, If someone knows something related to how to work with tables in c# send me the link.
Thank you.
-
July 9th, 2008, 10:00 AM
#4
Re: Table - How to?
look into using a DataGridView. It's default functionality is to allow user editing, adding, and deleting.
-
July 9th, 2008, 11:37 AM
#5
Re: Table - How to?
'DataTable' class is used for making a table in memory.
'DataTable' class has a collection of 'DataRow' class.
'DataTable' class has a collection of 'DataColumn' class.
You add desired number of columns in DataTable by using Add() method.
DataColumn's constructor takes column name and its data type as parameters.
You add your desired number of rows in table by something like this
Code:
DataRow newRow = myDataTable.NewRow();
You add your columns data by something like this
Code:
newRow["columnAge"] = 50;
newRow["columnName"] = "Coder";
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|