473,695 Members | 2,167 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 3809
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
3497
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
7357
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
6404
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
1316
by: Silvia | last post by:
H It is possible in a datagrid by code do the columns autosize? Thanks
9
10374
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
2119
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
3421
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
6221
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
6587
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
8635
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
8574
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
8990
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...
1
8850
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,...
0
7664
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...
0
5839
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4580
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3007
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
2
2276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.