datagridview question

  • Thread starter Thread starter DBC User
  • Start date Start date
D

DBC User

Couple of questions

1. I have a dataset with 10 columns, I want to display only 5 columns
from this dataset in the datagridview. How can I do this?
2. I want to change the caption of each of the 5 columns.
3. Can I drag and drop the columns dynamically like the 3rd party
datagrids in Datagridview?

Thanks.
 
1. for autogenerated colums you can use
dataGridView1.Columns[3].Visible = false;

2. for autogenerated colums you can use dataGridView1.Columns[3].Text
= "New caption";
3. yes, I think it is possible - see
DataGridView.AllowUserToOrderColumns Property
http://msdn2.microsoft.com/en-US/li...rms.datagridview.allowusertoordercolumns.aspx

for 1 and two - you should consider to set
DataGridView.AutoGenerateColumns to false adn add columns as described
here
http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview.columns.aspx

hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com
 

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

Back
Top