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

Threaded View

  1. #1
    Join Date
    Jun 2005
    Posts
    8

    Question How to customize the columns of a DataGrid which is based on a IList?

    For example, I have a couple of Student records and want to show them by a DataGrid.

    Student:
    DWORD ID;
    string strName;
    string strAddress,
    string strEmail.

    So, I create a List of Students and bind it with a DataGrid as follows.

    //Create a list of Students.
    IList students = new ArryList();
    students.add(new Student(1, "steven"......));
    student.add(new Student(2, "Tom"......));
    ......

    //Bind DataGrid to these data source.
    myDataGrid.DataSource = students;

    Now, I can get a DataGrid which has four columns...say, ID, Name, Email, Address... but, however, what I need to do is to customize these columns, for example, I only want to show two columns, Name and Email...or,even i want to show the Email column before/after Name...or somthing else.

    What should I do? Must I inherite from the DataGrid and rewrite my own DataGrid?
    Last edited by Atlantis11500; September 26th, 2006 at 04:02 AM.

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