<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'resize datagrid in vb.net  very urgent !!!!!!' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'resize datagrid in vb.net  very urgent !!!!!!' posted on the 'VB.NET' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 12:43:18 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 12:43:18 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>resize datagrid in vb.net  very urgent !!!!!!</title>
      <link>http://www.programmersheaven.com/mb/VBNET/351827/351827/resize-datagrid-in-vbnet--very-urgent-/</link>
      <description>hi,&lt;br /&gt;
  I am aswin ,i am doing a project in vb.net sql server&lt;br /&gt;
i want to resize my datagrid during the run time according to the information it contains  .please send the details of this subject &lt;br /&gt;
very urgent !!!!!!!!!!1&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/351827/351827/resize-datagrid-in-vbnet--very-urgent-/</guid>
      <pubDate>Sun, 07 Jan 2007 00:26:08 -0700</pubDate>
      <category>VB.NET</category>
    </item>
    <item>
      <title>Re: resize datagrid in vb.net  very urgent !!!!!!</title>
      <link>http://www.programmersheaven.com/mb/VBNET/351827/351853/re-resize-datagrid-in-vbnet--very-urgent-/#351853</link>
      <description>&lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by DrMarten at  2007-1-7 15:44:43&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
&lt;br /&gt;
: hi,&lt;br /&gt;
:   I am aswin ,i am doing a project in vb.net sql server&lt;br /&gt;
: i want to resize my datagrid during the run time according to the information it contains  .please send the details of this subject &lt;br /&gt;
: very urgent !!!!!!!!!!1&lt;br /&gt;
---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
You will have to experiment with sizes for your data however&lt;br /&gt;
here is some code for you to play with some of the size properties.&lt;br /&gt;
&lt;br /&gt;
Remember to set the TOP and LEFT in your properties window AND&lt;br /&gt;
in your code so the DataGrid doesn't physically move.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
    Private Sub DataGrid1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.Click
        Dim mySize As System.Drawing.Size&lt;strong&gt;&lt;span style="color: Green;"&gt;
        'Set a size of 200 by 200.&lt;/span&gt;&lt;/strong&gt;
        mySize.Height = 200
        mySize.Width = 200
        DataGrid1.Size = mySize&lt;strong&gt;&lt;span style="color: Green;"&gt;
        'Set the column width and height in pixels.&lt;/span&gt;&lt;/strong&gt;
        DataGrid1.PreferredColumnWidth = 20
        DataGrid1.PreferredRowHeight = 20&lt;strong&gt;&lt;span style="color: Green;"&gt;
        'Scale the DataGrid.&lt;/span&gt;&lt;/strong&gt;
        DataGrid1.Scale(1.2)&lt;strong&gt;&lt;span style="color: Green;"&gt;
        'or use two numbers to scale it by width and height.&lt;/span&gt;&lt;/strong&gt;
        DataGrid1.Scale(1.2, 1.5)&lt;strong&gt;&lt;span style="color: Green;"&gt;
        'Keep the top and left at 100 pixels down and from the left.&lt;/span&gt;&lt;/strong&gt;
        DataGrid1.Top = 100
        DataGrid1.Left = 100
    End Sub
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I've just thought, as it is the text mostly that changes then you&lt;br /&gt;
 could use a scrollbar to scale the width of the DataGrid, or as well as the column width only. &lt;img src="http://www.programmersheaven.com/images/Community/smile.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
Use the following with a scrollbar just above or below your DataGrid,&lt;br /&gt;
however you like it.&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
   Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll

        Dim mySize As System.Drawing.Size
        HScrollBar1.Minimum = 1
        HScrollBar1.Maximum = 500
        Dim myVal As Integer
        myVal = HScrollBar1.Value
        mySize.Width = myVal
        DataGrid1.Width = myVal
        DataGrid1.Top = 100
        DataGrid1.Left = 100

    End Sub
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
You could add a 2nd scrollbar to adjust the &lt;br /&gt;
height using a VscrollBar in a similiar way. &lt;img src="http://www.programmersheaven.com/images/Community/twink.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;
Another Hscrollbar could adjust the columnWidth. &lt;img src="http://www.programmersheaven.com/images/Community/smile.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Regards,&lt;br /&gt;
&lt;br /&gt;
Dr M.&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/351827/351853/re-resize-datagrid-in-vbnet--very-urgent-/#351853</guid>
      <pubDate>Sun, 07 Jan 2007 15:06:39 -0700</pubDate>
      <category>VB.NET</category>
    </item>
  </channel>
</rss>