Moiz Saifuddin
asked on
windows app
What control do I use if I want to display a muti column list of rows and on selection they should trigger an event. I am using windows app in .net
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have decided to go for a GridView but i am facing this error attached. I am receiving on line 60 after setting datasource to the grid.Any fix to this
headerErr.JPG
headerErr.JPG
ASKER
Prob resolved...
Sorry, it was the night for me.
You usually do not use DataMember with a DataGridView. It is useful only when the grid is working with a DataSet that has multiple tables.
And by the way, you have made a common mistake. You do not use a DataSet when you have a single table. The role of a DataSet is to maintain relations between many tables. If you have only one, it is useless and simply adds extra overhead.
Simply use a DataTable object and use Fill on that object instead of the DataSet:
DataTable dt = New DataTable();
...
pagingAdapter.Fill(dt);
DataView dvEmp = dt.DefaultView;
Also, do you really need a DataView? If you do not sort or filter later on, the DataView is also useless. You can assign the DataTable directly to the DataSource, so your GetData method could simply return the DataTable.
One of the main advantages of ADO.NET is that it is very versatile and you can use it in many different ways depending on your needs. One of the main disadvantage of ADO.NET is that because of that versatility, the web is full of useless code that everybody copies without really understanding what they are doing, and everybody ends up transmitting that code to everybody else.
You usually do not use DataMember with a DataGridView. It is useful only when the grid is working with a DataSet that has multiple tables.
And by the way, you have made a common mistake. You do not use a DataSet when you have a single table. The role of a DataSet is to maintain relations between many tables. If you have only one, it is useless and simply adds extra overhead.
Simply use a DataTable object and use Fill on that object instead of the DataSet:
DataTable dt = New DataTable();
...
pagingAdapter.Fill(dt);
DataView dvEmp = dt.DefaultView;
Also, do you really need a DataView? If you do not sort or filter later on, the DataView is also useless. You can assign the DataTable directly to the DataSource, so your GetData method could simply return the DataTable.
One of the main advantages of ADO.NET is that it is very versatile and you can use it in many different ways depending on your needs. One of the main disadvantage of ADO.NET is that because of that versatility, the web is full of useless code that everybody copies without really understanding what they are doing, and everybody ends up transmitting that code to everybody else.
ASKER
Thanks for the reply, that helped.
http://msdn.microsoft.com/en-us/library/ez0wd97x(v=vs.80).aspx
Once you added the control, select the required function from the event properties