Solved

Adjusting column widths fr a DataGrid

Posted on 2006-11-04
3
247 Views
Last Modified: 2010-04-16

Hi,

Here's the code I use to format the columns:


driverStatData = new DataSet();
driverStatTable = new DataTable("DriverStatsTable");
driverStatData.Tables.Add(driverStatTable);
driverStatTable.Columns.Add(new DataColumn("Statistic", typeof(string)));
driverStatTable.Columns.Add(new DataColumn("Col 1", typeof(double)));
driverStatTable.Columns.Add(new DataColumn("Col 2", typeof(double)));
driverStatTable.Columns.Add(new DataColumn("Percent", typeof(string)));


How do I give the first column more width?

Thanks.
Bob
0
Comment
Question by:ba272
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 500 total points
ID: 17875274
Hi,

Depending on your needs the following two links should help:
http:Q_21726249.html "windows form datagrid"
http:Q_21517523.html "Expanding the column of a datagrid on load"

alternativley for more information you can refer to:
http://support.microsoft.com/default.aspx?scid=kb;en-us;812422
http://www.codeproject.com/cs/miscctrl/AutoResizeDataGrid.asp
http://www.codeproject.com/cs/miscctrl/WCsAutoSizeDataGrid.asp
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17875317
Thanks for the mark and the grade.
0
 

Author Comment

by:ba272
ID: 17875322
no problem...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vb.net dynamic formulas in runtime 11 75
Angular - break the dataset in chunks? 7 51
Simple Injector with Web Service 4 41
Calculate number of nights between two dates 5 25
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question