473,804 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows.Forms.D ataGrid :- How to return the coloum width at runtime??

Hi all
I am looking to return the width of a given column in a
Windows.Forms.D ataGrid at runtime. This would seem to be a much needed
straight forward property request, but I can't find a simple way of
getting it. I believe the DataGridColumnS tyle class should be able to
return this width, but how do you get the DataGridColumnS tyle instance
for a given column? I am sure that there is a collection somewhere but
cant find.

My datagrid is constructed from a DataSet, and formatted with the
property select 'Auto Format' in the properties panel in Visual
Studio. Though this seams to simply set datagrid properties directly to
make it pretty, and not create a collection of DataGridColumnS tyle or
table styles.
Thanks..

Nov 17 '05 #1
3 1475
Phillip,

Check:

http://www.syncfusion.com/FAQ/Window...44c.aspx#q792q

Regards - Octavio

<ph**********@p ramerica.ie> escribió en el mensaje
news:11******** *************@f 14g2000cwb.goog legroups.com...
Hi all
I am looking to return the width of a given column in a
Windows.Forms.D ataGrid at runtime. This would seem to be a much needed
straight forward property request, but I can't find a simple way of
getting it. I believe the DataGridColumnS tyle class should be able to
return this width, but how do you get the DataGridColumnS tyle instance
for a given column? I am sure that there is a collection somewhere but
cant find.

My datagrid is constructed from a DataSet, and formatted with the
property select 'Auto Format' in the properties panel in Visual
Studio. Though this seams to simply set datagrid properties directly to
make it pretty, and not create a collection of DataGridColumnS tyle or
table styles.
Thanks..

Nov 17 '05 #2
Try:

this.dataGrid1. TableStyles["<TABLENAME >"].GridColumnStyl es["<COLUMNNAM E>"].Width = size;

as stolen from: http://support.microsoft.com/Default.aspx?id=812422

Brendan

"ph**********@p ramerica.ie" wrote:
Hi all
I am looking to return the width of a given column in a
Windows.Forms.D ataGrid at runtime. This would seem to be a much needed
straight forward property request, but I can't find a simple way of
getting it. I believe the DataGridColumnS tyle class should be able to
return this width, but how do you get the DataGridColumnS tyle instance
for a given column? I am sure that there is a collection somewhere but
cant find.

My datagrid is constructed from a DataSet, and formatted with the
property select 'Auto Format' in the properties panel in Visual
Studio. Though this seams to simply set datagrid properties directly to
make it pretty, and not create a collection of DataGridColumnS tyle or
table styles.
Thanks..

Nov 17 '05 #3
Excelent Brendan, worked a treat.

Nov 17 '05 #4

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

Similar topics

2
1128
by: Al | last post by:
I have a useful framework, written in a different language (PowerBuilder), which I'd like to replicate in .Net and Forms, but I'm unsure of how to approach it, as the Event model is being used different between the development environments. Currently we have data entry screens, whose columns have been "wired" into a class that performs checks on the entered data. As the user "leaves" a column, the specific check / business rule is...
0
2317
by: Tim Haughton | last post by:
I've just released an article on using Test Driven Development with C# and Windows Forms. GUI's are often difficult to test, so I thought it might be of interest. The article along with the example source code can be downloaded here: http://www.blogitek.com/timhaughton/archives/files/User%20Interrogator%20And%20TDD.zip The article text is below. Not sure what it will do to the formatting when
9
2827
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am facing. Please please help me to solve this as soon as possible. So here we go ... I am not able to take the screen shot of the windows form based "Smart
1
2153
by: martin | last post by:
Hi, I have a datagrid that contains 3 colums. This is rendered to the page fine, except that I would like to be able to control the width of each table cell of the datagrid I have the following code in the "ItemDataBound" -- which I belive should allow me to alter the width of the cells, however it does not work. Dim unitWidth As Unit unitWidth.Percentage(10)
0
254
by: Newbie! | last post by:
Hi Ppl, Sorry to be a pain again but .... On a DataGrid how could i set the Coloums colour and Width. The Coloum works fine, but i carn`t figure out how to get the coloum width to change. Ta Si
4
3163
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps further away, completely leaving the selector box area. Any ideas? VS 2003 and VB.Net This is a simple application at the moment but the form is inherited from a
6
4368
by: Bob The Builder | last post by:
I have a custom-built datagrid for windows forms. I overrode the scrollbars in it because I wanted to draw my own (basically, they're skinned). As a result, I handle all scroll events and calls. I also have a row-selector column as the first column, and that needs to stay visible. Think Excel. However, if a user clicks a cell that is all the way to the right and goes off the grid a bit, then the entire grid shifts, including my...
6
5615
by: Nathan Laff | last post by:
Why when I inherit a ComboBox and make no code changes, when I set the new control DropDownStyle to dropDownList it appears different than the standard ComboBox control on Vista? In Windows Vista when this mode is set, the control is all one color indicating that you can't type in it and looks really slick. How do i reproduce this behavior?
1
1769
by: radhikabista | last post by:
hey friends , i m not being able to save the updates in datagrid view when i press buttonsave_ gridview i have a class customer with two methods one to get the dataset and other to update database: i dont know what is the problem with my code. i always get UPDATE syntax run time error, as i press button_save_grod view : please help me. my code goes like this: public class customer { // private static string strConn;
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10350
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9174
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7638
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.