473,408 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

DatagridView Column Headers

Hi

I've been looking through the properties and I can't seem to find a way
to adjust the column width. Is there a way to do this?

Also, when the datagridview is displaying data, there is a "column" on
the far left used to select records. Is there any way to remove this
column? Or change it's width to something smaller (like zero)?

I appreciate your help very much.

Thanks

Jer

Aug 25 '06 #1
3 12375
On 25 Aug 2006 15:57:32 -0700, "jer84" <je*******@gmail.comwrote:
>Hi

I've been looking through the properties and I can't seem to find a way
to adjust the column width. Is there a way to do this?
You have to have some columns first before you can set a column width. If you added columns in
Design, then you could have set the column width in the column's width property.
>Also, when the datagridview is displaying data, there is a "column" on
the far left used to select records. Is there any way to remove this
column? Or change it's width to something smaller (like zero)?
You must have missed the RowHeadersVisible Property while you were looking through the
DataGridView's property window.

Gene

Aug 25 '06 #2
Perhaps you can use the RowHeadersWidth properties, eg:

'RowHeadersWidth minimum is 4
DataGridView1.RowHeadersWidth = 4

'Then for your data column, try this (20 to give space to vertical scrollbar
if it exists...
DataGridView1.Columns(0).Width = DataGridView1.Width - DataGridView1.
RowHeadersWidth - 20

HTH.

--
Regards,
Pedestrian, Penang.

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200608/1

Aug 25 '06 #3
Thanks Gene,

I can now resize my columns.
pedestrian via DotNetMonster.com wrote:
Perhaps you can use the RowHeadersWidth properties, eg:

'RowHeadersWidth minimum is 4
DataGridView1.RowHeadersWidth = 4

'Then for your data column, try this (20 to give space to vertical scrollbar
if it exists...
DataGridView1.Columns(0).Width = DataGridView1.Width - DataGridView1.
RowHeadersWidth - 20
And thanks Pedestrian,

That worked for getting that first row out of the way!

All issues are resolve and very quickly. Thanks again

Jer

Aug 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Veeneman | last post by:
How can I set a bound DataGridView control to use a dataset table's column captions, instead of column names? I'm working with a DataGridView control, which I have bound to a table in a dataset....
1
by: martin1 | last post by:
Hi, All, DataGridView is populated with all coumns from database since i need some columns data for condition statement, after that I want to show rest of column in the DataGridView, so how to...
3
by: Mike | last post by:
Dear group, I'm currrently investigating a bug within a piece of our software whereby if a DataGridView (bound directly to a DataTable) is ordered by column headers (containing lookup combo...
1
by: osmarjunior | last post by:
I want to create columns in my DataGridView just like that: ______________________________________ |________________Taxes________________| |_______Tax 1_______|______Tax 2______| | 3,50 ...
2
by: Samuel | last post by:
Hi I would like to change the column headers appearance, is it possible? I did change the ColumnHeaderDefaultCellStyle but it has no effect Thank you, Sam
3
by: Rick | last post by:
I'm adding columns to a datagridview in code. When I run the program the data is bound correctly, but none of the column headers show. Can someone point out what obvious mistake I am making? ...
3
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Hi all, How do I prevent the user from clicking on the column headers, thereby preventing the user from sorting the records in the datagridview ? Is there like a datagridview1.Sort = false : ...
2
by: Steve | last post by:
Hi All I am using VB.net 2005 windows forms I use the Datagridview.cellformatting event to change the colours of individual cells as required and all works fine How can I do the same for...
0
by: lenniekuah | last post by:
Hi Fellow Good Guys, I need your help, Please Help me. Surprising I encounterd another problem which never happened in VB.NET but in C# technique it causing problem. Here is the explanation...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.