By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

datagridview question

P: n/a
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.

May 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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/lib...ercolumns.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/lib...w.columns.aspx

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

May 25 '06 #2

P: n/a
Thanks and thats what I wanted.

Galcho[MCSD.NET] wrote:
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/lib...ercolumns.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/lib...w.columns.aspx

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


Jun 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.