HighTechTalks DotNet Forums  

Re: Datagrid Column widths (VB.NET)

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Re: Datagrid Column widths (VB.NET) in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ken Tucker [MVP]
 
Posts: n/a

Default Re: Datagrid Column widths (VB.NET) - 01-24-2005 , 07:04 AM






Hi,

Try something like this is the datagrid mouse move
event.


Private Sub DataGrid1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseMove

Dim hti As DataGrid.HitTestInfo

hti = DataGrid1.HitTest(e.X, e.Y)

If hti.Type = DataGrid.HitTestType.ColumnResize Then

Debug.WriteLine(String.Format("Resized Column {0}", hti.Column))

End If

End Sub



Ken

-------------------

"spongebob-straight-pants" <asd (AT) asd (DOT) com> wrote

Hi,
I apologize if this was discussed before but I could not find a solution
that worked by looking through these NGs.

If I made the DG resizeable, the user resizes it in run time and the form is
reloaded, the column widths are setting back to their default values. How
would I prevent that (in other words, have the resized width persist??)

I tried this code with a module level variable marr() but I have no idea on
where to place this code? Is there a resize event that fires when the
columns are resized? There is a resize event but that does not get fired
when the columns are resized.

'Dim idx As Integer

'With dgLocations.TableStyles(0)

' ReDim marrCol(.GridColumnStyles.Count - 1)

' For idx = 0 To .GridColumnStyles.Count - 1

' marrCol(idx) = .GridColumnStyles(idx).Width

' Next idx

'End With






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.