PC Review


Reply
Thread Tools Rate Thread

datagrid and columnwidth

 
 
max
Guest
Posts: n/a
 
      20th Apr 2005
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


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      20th Apr 2005
<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/vbtchformattingwindowsformsdatagridvisualbasicprimer.asp>
-> "Setting Column Width"

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

 
Reply With Quote
 
rawCoder
Guest
Posts: n/a
 
      20th Apr 2005
Are You Using GridColumnStyle
If not , try using that

HTH
rawCoder

<max> wrote in message news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      20th Apr 2005
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


 
Reply With Quote
 
max
Guest
Posts: n/a
 
      21st Apr 2005
Well, I guess I was just being ****y 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 ****y, 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
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Columnwidth Jean-Paul Microsoft Excel Misc 1 24th Nov 2009 02:21 PM
datagrid and columnwidth max Microsoft VB .NET 4 21st Apr 2005 01:34 AM
Columnwidth datagrid webform =?Utf-8?B?V2lsbGVt?= Microsoft ASP .NET 1 20th Feb 2005 04:19 AM
DataGrid-ColumnWidth Hannes Microsoft VC .NET 0 6th Nov 2004 10:30 AM
DataGrid: How to expand columnwidth to fit column contents Jakob Persson Microsoft C# .NET 1 17th Jul 2003 05:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:13 PM.