473,387 Members | 1,463 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,387 software developers and data experts.

Resize DataGrid Control's columns - VB.NET

Hi!

My question is if it's possible to adjust DataGrid control's columns' width
by code (runtime).
I have a DataGrid control that displays table from dataset that contains two
fields. The first one is just an ID, which is 4 digits long, while the other
field is a long text field. I don't want the user to change it every time
when the form loads, but do it for him by code.

Any idea will be thankful!
Tom Rahav.
Jul 22 '05 #1
1 3371
Hi Tom,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to control the width of each
column in a DataGrid control. If there is any misunderstanding, please feel
free to let me know.

As far as I know, to control the width of each column, we have to add
TableStyles and GridColumnStyles. We can add a TableStyle for the whole
table and add GridColumnStyles for each column. In the DataGridColumnStyle,
we change the Width property to achieve this.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwindowsformsdatagridcolumnstyleclasswid thtopic.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 22 '05 #2

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

Similar topics

5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: VB Programmer | last post by:
I cannot get my first 2 columns to adhear to my width settings. Any ideas? The datagrid is defined as: <asp:DataGrid id="dgLog" runat="server" Width="990px" Height="96px"...
7
by: BobAchgill | last post by:
I am trying to decide which of these controls to use to implement letting my user select a full row from MyList. The MyList has several columns which would be nice to sort by at run time. The...
1
by: Tom Rahav | last post by:
Hi! My question is if it's possible to adjust DataGrid control's columns' width by code (runtime). I have a DataGrid control that displays table from dataset that contains two fields. The first...
1
by: garyusenet | last post by:
I'm following a sql/vb tutorial which contains the following code which is meant to resize the datagrid view so that the columns take the correct width for the content within them. It doesn't...
4
by: gane | last post by:
Hi, I am creating datagrid bound column dynamically and need to check if a datagrid column already exists?Is there a way to check this? thanks gane
4
by: tasiekk | last post by:
I need to know how i can resize datagrid on a page when user will resize web browser window or maximize this window. Resizeing normal DIV is simple - expression but i dont know how to resize more...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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...

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.