Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 28th, 2004, 09:02 AM
Registered User
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Column Width resize problem

Hello All
I am trying to preserve the width of column in a datagrid
on form load i use this
    Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(0).Width = 30
    Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(1).Width = 30
    Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(2).Width = 30

After i update the datagrid dataset i manualy rezised the 3 columns so that only the 1st letter is visible.
    Dim tableStyle As DataGridTableStyle
    tableStyle = New DataGridTableStyle
    tableStyle.MappingName = "artenc"

    WidthDatagrid2(0) = Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(0).Width
    WidthDatagrid2(1) = Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(1).Width
    WidthDatagrid2(2) = Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(2).Width

    Console.WriteLine(Me.DataGrid2.TableStyles("artenc ").GridColumnStyles(1).Width)
    Console.WriteLine(Me.DataGrid2.TableStyles("artenc ").GridColumnStyles(1).Width)
    Console.WriteLine(Me.DataGrid2.TableStyles("artenc ").GridColumnStyles(2).Width)
all the console display 75 and i sure the width is not 75!?

Any suggestion on how to store the width of datagrid's column? I can't any useful event for that.


Kind Regards

Similar Threads
Thread Thread Starter Forum Replies Last Post
Align or increase width for 1 column in DataGrid remya1000 General .NET 1 June 17th, 2008 04:21 PM
DataGrid Column Width Problem demivolt ASP.NET 1.0 and 1.1 Professional 1 July 22nd, 2005 09:05 AM
Setting Column width in Datagrid anita General .NET 2 April 13th, 2005 02:25 AM
DataGrid column width johanyu VS.NET 2002/2003 0 October 30th, 2004 05:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.