472,330 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,330 software developers and data experts.

datagrid and columnwidth

max
I am not being a smartass and would honestly like an explanation, if
you could take the time.

What's wrong with:

DataGrid.Column(0).Width = 30?
or
DataGrid.Column(2).Width = DataGrid.Width - _
(DataGrid.Column(0).Width + _
DataGrid.Column(1).Width) ?

Is there something wrong with simplicity?? Does this not cover all
the bases? Or possibly could it be to keep the humbled masses in there
place? Or ?

Thanks for your time,
--max
Nov 21 '05 #1
4 1346
<max> schrieb:
I am not being a smartass and would honestly like an explanation, if
you could take the time.

What's wrong with:

DataGrid.Column(0).Width = 30?


I am not very familar with the datagrid, but you may want to take a look at
the page referenced below:

<URL:http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vbtchformattingwindowsformsdatagridvisualbasicprim er.asp>
-> "Setting Column Width"

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Are You Using GridColumnStyle
If not , try using that

HTH
rawCoder

<max> wrote in message news:n2********************************@4ax.com...
I am not being a smartass and would honestly like an explanation, if
you could take the time.

What's wrong with:

DataGrid.Column(0).Width = 30?
or
DataGrid.Column(2).Width = DataGrid.Width - _
(DataGrid.Column(0).Width + _
DataGrid.Column(1).Width) ?

Is there something wrong with simplicity?? Does this not cover all
the bases? Or possibly could it be to keep the humbled masses in there
place? Or ?

Thanks for your time,
--max

Nov 21 '05 #3
Max,

An in my opinion very simple sample for an extended use of the table style
that I made yesterday, and changed a little bit for this message here in the
message (when there are typos)

\\\Needs only a datagrid on a form
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
dt.Columns.Add("MyColumn")
dt.LoadDataRow(New Object() {"Cor"}, True)
dt.LoadDataRow(New Object() {"Herfried"}, True)
dt.LoadDataRow(New Object() {"Crouchie"}, True)
dt.LoadDataRow(New Object() {"Ken"}, True)
dt.LoadDataRow(New Object() {"Jay"}, True)
'here start the sample
Dim ts As New DataGridTableStyle
ts.MappingName = dt.TableName
Dim column As New DataGridTextBoxColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
ts.PreferredRowHeight = 30
DirectCast(column.TextBox, DataGridTextBox).Font = _
New System.Drawing.Font("Arial", 14, FontStyle.Bold)
column.Alignment = HorizontalAlignment.Center
column.MappingName = dt.Columns(0).ColumnName
column.HeaderText = "Names"
column.Width = 100
DataGrid1.DataSource = dt
End Sub
///

I hope this helps a little bit?

Cor
Nov 21 '05 #4
max
Well, I guess I was just being pissy this morning. Thanks for all of
the kind responses.

But I was questioning the nature of how we go about setting the column
width on grid. Seems to me that .Width or .ColumnWidth was pretty
straight forward, but, well, now, it takes seven steps to do what we
could do in an assignment. Is this progress??

Okay, maybe I'm still pissy, but enquiring minds want to know.

Thanks again for your time,
--max
On Wed, 20 Apr 2005 09:49:05 -0600, max wrote:
I am not being a smartass and would honestly like an explanation, if
you could take the time.

What's wrong with:

DataGrid.Column(0).Width = 30?
or
DataGrid.Column(2).Width = DataGrid.Width - _
(DataGrid.Column(0).Width + _
DataGrid.Column(1).Width) ?

Is there something wrong with simplicity?? Does this not cover all
the bases? Or possibly could it be to keep the humbled masses in there
place? Or ?

Thanks for your time,
--max


Nov 21 '05 #5

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

Similar topics

1
by: Jakob Persson | last post by:
Hi Is there a way to program a DataGrid control to automatically adjust its columnwidth so it fits the contents of the columns. I am...
0
by: Hannes | last post by:
Hello! When doubleclicking on the columnseparator of a datagrid the columnwidth ist set to the optimal size for the instantaneous content. Is...
0
by: Hannes | last post by:
Hello! When doubleclicking on the columnseparator of a datagrid the columnwidth ist set to the optimal size for the instantaneous content. Is...
1
by: BC | last post by:
Hi, Been searching the newgroups but haven't found an answer. I'm used to binding disconnected ADO recordsets to Datagrid controls and...
1
by: Willem | last post by:
Hi, I'm using a datagrid on a webform with 4 visible and 1 invisible columns. When clicking a button I want to make the invisible column visible....
2
by: Andrew Baker | last post by:
Coming from VB, I find the changes needed to manipulate a datagrid are much more taxing than previously. Is there a good tutorial for things...
4
by: Paul Ilacqua | last post by:
I'm filling the datagrid with no problem but I do not see a columnwidth property anywhere. How do you set the columnwidth property of the datagrid...
0
by: Bob Davies | last post by:
Hi I have a webservice that retrieves data from a database, this is then returned to the calling client application built in windows forms within...
1
by: Price Brattin | last post by:
How do I set the column width in a datagrid when the datasource is a dataview? I want to use a dataview so data changes, inserts, and deletes are...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.