I have been coding in Visual Basic with Excel for a while and am now getting into using databases within the code. I have been looking everywhere trying to find how one can code for the datagrid width. I have figured out the individual columns but I want to code for the entire grid width. I am trying to code the datagrid to be the exact total of all of the columns eliminating the horizontal scrollbar and then next I will eliminate the vertical scrollbar for any account that has less than five records. Can anyone help or point me in the right direction?
DataGrid Width (VB.Net - Visual Studio 2003)DataGrid Width - automatic
Page 1 of 1
4 Replies - 4720 Views - Last Post: 29 June 2009 - 12:01 PM
Replies To: DataGrid Width (VB.Net - Visual Studio 2003)
#2
Re: DataGrid Width (VB.Net - Visual Studio 2003)
Posted 29 June 2009 - 09:35 AM
Holy crap, sorry, I made a response to the wrong post!
This post has been edited by LoveIsNull: 29 June 2009 - 09:36 AM
#3
Re: DataGrid Width (VB.Net - Visual Studio 2003)
Posted 29 June 2009 - 09:42 AM
You can change the width of your datagridview by changing the width property....
i.e. DataGridView1.Width = 1000 (or whatever the sum of your column widths are).
i.e. DataGridView1.Width = 1000 (or whatever the sum of your column widths are).
#4
Re: DataGrid Width (VB.Net - Visual Studio 2003)
Posted 29 June 2009 - 10:51 AM
Thanks for the reply Eric but the problem is that in Visual Studio 2003 there is no DataGridView only a DataGrid. When you set it, it remains that width. I tried to find possible code that will allow me to add up the widths of the columns and use that for grid width but there does not seem to be a way. And the company I am currently at does not want to pay for the 2005 version.
#5
Re: DataGrid Width (VB.Net - Visual Studio 2003)
Posted 29 June 2009 - 12:01 PM
You can set the width property in 2003 in run-time.. After you set it though, call the Scale method:
The width property would make my datagrid not visible until I called the scale method.
DataGrid1.Width = 500 ' or whatever DataGrid1.Scale(1, 1)
The width property would make my datagrid not visible until I called the scale method.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|