CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Table - How to?

  1. #1
    Join Date
    May 2008
    Posts
    66

    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!

  2. #2
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Table - How to?

    we will not do your homework for you.

  3. #3
    Join Date
    May 2008
    Posts
    66

    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.

  4. #4
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Table - How to?

    look into using a DataGridView. It's default functionality is to allow user editing, adding, and deleting.

  5. #5
    Join Date
    Apr 2006
    Posts
    220

    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
  •  





Click Here to Expand Forum to Full Width

Featured