473,795 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

autosize DataGrid column

I'm using Visual Studio 2003. Is there a way one can cause columns in a
DataGrid to autosize? Also, is there a way to cause the last column to take
up the remaining space between the end of the column and the right edge of
the DataGrid? And finally, is there a way to remove the row that permits a
user to add data? I looked in the Help, but was unable to discern the
answers to the aforementioned questions.

Tim
Nov 17 '05 #1
2 3813
Tim,

I don't think there is a way to perform the sizing operations you
specified. If anything, you would have to perform all of the calculations
yourself, and then apply it to the size.

As for removing the final row that permists a user to add data, bind to
a DataView on your table, setting the AllowNew property on the view to
false.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Tim Wallace" <twallace-ThisDoesNotBelo ng-AT-emailDOTcom> wrote in message
news:Ou******** ******@TK2MSFTN GP12.phx.gbl...
I'm using Visual Studio 2003. Is there a way one can cause columns in a
DataGrid to autosize? Also, is there a way to cause the last column to
take up the remaining space between the end of the column and the right
edge of the DataGrid? And finally, is there a way to remove the row that
permits a user to add data? I looked in the Help, but was unable to
discern the answers to the aforementioned questions.

Tim

Nov 17 '05 #2
There's nothing build into the .Net Framework which does the Auto-size.
However, there was an article about in of CodeProject.com some time ago.

--
--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com

"Tim Wallace" <twallace-ThisDoesNotBelo ng-AT-emailDOTcom> wrote in message
news:Ou******** ******@TK2MSFTN GP12.phx.gbl...
I'm using Visual Studio 2003. Is there a way one can cause columns in a
DataGrid to autosize? Also, is there a way to cause the last column to take up the remaining space between the end of the column and the right edge of
the DataGrid? And finally, is there a way to remove the row that permits a user to add data? I looked in the Help, but was unable to discern the
answers to the aforementioned questions.

Tim

Nov 17 '05 #3

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

Similar topics

1
3506
by: | last post by:
How I can autosize a DataGrid after then associate a Datasource=Dataset in Smart Devices applications or Windows forms application?? That same?? -- Cumprimentos, David de Passos -------------------------------------------------------------- RCSOFT, Lda.
1
7360
by: Cybertof | last post by:
Hello, Do you know why in the following code the result is a column of size 0 ? (in the doc it says to use -2 to autosize column header...) ColumnHeader MyColumnHeader = new ColumnHeader(); MyColumnHeader.Text = "col1"; MyColumnHeader.Width = -2; // if you remove this line col appears MyListView.Columns.Add(MyColumnHeader);
2
6414
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
1
1318
by: Silvia | last post by:
H It is possible in a datagrid by code do the columns autosize? Thanks
9
10393
by: Kevin Westhead | last post by:
Can anyone confirm whether or not there are any limits imposed on the widths of autosized columns in a list-view. I've found that the autosizing appears to have an upper limit, i.e. it will not expand beyond some (unknown) maximum length. This applies to user-autosizing (double-clicking the divider) and code-autosizing using LVSCW_AUTOSIZE. For example, create a new project and place a ListView (VB5 version) and CommandButton on a form...
1
2122
by: Gunjan Shah | last post by:
I am developing one Windows application in which i am bindig a data with datagrid. Now i am not able to autosize the columns of datagrid so data looks properly. is there any facility like autosizing the columns? if yes then wat to do? and if not then what is the solution?
8
3430
by: Jordi Rico | last post by:
Hi, I've made the next inherited class in Visual Studio 2005: Public Class LabelEx Inherits System.Windows.Forms.Label Sub New() MyBase.New() Me.ForeColor = Color.Black Me.AutoSize = False Me.Height = 16
1
6231
by: SAL | last post by:
How do I get a CELL to autosize a round a Control in a HTML Table? For example, you add a 2 row, 3 column HTML table to your webpage. In the 1st row, you set the colspan=3, then delete the excess columns. Now the 1st row should look like it has only 1 cell, and the 2nd row has 3 cells. Now add a Web Forms DataGrid in row, and add a Web Forms Button in the middle cell of row 2. Now, when I try to resize the row, I can’t seem to get...
2
6598
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
9673
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
9522
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
10448
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...
1
10167
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7544
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
5440
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...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2922
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.