4 Replies - 5326 Views - Last Post: 29 June 2009 - 12:01 PM Rate Topic: -----

#1 TedSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-June 09

DataGrid Width (VB.Net - Visual Studio 2003)

Posted 29 June 2009 - 07:44 AM

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?

Is This A Good Question/Topic? 0
  • +

Replies To: DataGrid Width (VB.Net - Visual Studio 2003)

#2 LoveIsNull  Icon User is offline

  • Recovering D.I.C Addict
  • member icon

Reputation: 52
  • View blog
  • Posts: 646
  • Joined: 10-March 09

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

Was This Post Helpful? 0
  • +
  • -

#3 erickh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 24-June 09

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).
Was This Post Helpful? 0
  • +
  • -

#4 TedSki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-June 09

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.
Was This Post Helpful? 0
  • +
  • -

#5 erickh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 24-June 09

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:

DataGrid1.Width = 500 ' or whatever
DataGrid1.Scale(1, 1)



The width property would make my datagrid not visible until I called the scale method.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1