Win Form - Data Grid Question.

D

DBC User

I have a dataset and I want to add this to a datagrid and then I want
to add 3 more columns to the data grid, based on values from existing
dataset. How can I do this in WinForm?? I see all the examples are for
ASP.Net. Could someone point me to a link or example I can do this in
WinForms?? I am using VS2005 / FW2.0

Thanks in advance.
 
G

Greg Young

Are you looking for how to programmatically add columns ? There are further
examples in MSDN under the related classes but ...

DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "Table";
DataGridTextBoxColumn cs = new DataGridTextBoxColumn();
cs.MappingName = "SomeColumn"; // Public property name
cs.HeaderText = "YourHeader";
cs.Width = 200;
ts.GridColumnStyles.Add(cs);
dataGrid1.TableStyles.Add(ts);

Or are you trying to figure out how to get the data from both sources in?
This is generally done by aggregating the data into a single source.

Cheers,

Greg Young
MVP - C#
 
D

DBC User

I am trying to get data from my dataset and 3 other derived columns
through program.
 
D

DBC User

Greg,

This is what I am trying to do. I am using database which doesn't
support view and I am using ORM. So I end up with access to one table
at a time. At run time, I will get the master table which has all the
columns. Before displaying, I need to convert 3 columns, which are
integer values to a string and these string values are stored in
seperate table.

This is what I am doing;
1. Access the master table and hide/show the columns based on user
setting.
2. I am accessing the reference table so I end up showing the integer
value instead of string values.

Could you please help?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top