<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno dom 3 feb 2019 alle ore 00:25 T Lee Davidson <<a href="mailto:t.lee.davidson@gmail.com">t.lee.davidson@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2/2/19 5:05 PM, Gianluigi wrote:<br>
> If with "Charlie" you're referring to me, also me can not get Expand to work.<br>
> But I think you can easily replace it with Width = -1<br>
<br>
Actually, no Gianluigi, I was not referring to you. I thought the code you first presented was directed toward someone else.<br></blockquote><div><br></div><div>yes, I was talking to Denis.<br>But I see no answers from Charlie in this discussion.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
As far as I understand the two, GridView_Column.Expand cannot be easily replaced with .Width = -1. The latter causes the width <br>
of the column to be resized according to the optimum width for the _data_ in the column. Whereas, .Expand works in relation to <br>
the combined width of the other columns and the .ClientWidth.<br>
<br>
I can achieve what I am wanting with:<br>
<br>
[code]<br>
Private iFixedColumnsWidth As Integer = 0<br>
<br>
Public Sub Form_Open()<br>
<br>
   Dim Headers As String[] = ["0123456789", "0123456789", "0123456789", "0123456789"]<br>
<br>
   With GridView1<br>
     .AutoResize = False<br>
     .Header = GridView.Horizontal<br>
   End With<br>
<br>
   GridView1.Rows.Count = 1<br>
   GridView1.Columns.Count = Headers.Count<br>
   For i As Integer = 0 To Headers.Max<br>
     GridView1.Columns[i].Title = Headers[i]<br>
     iFixedColumnsWidth += GridView1.Columns[i].Width<br>
   Next<br>
   iFixedColumnsWidth -= GridView1.Columns[0].Width<br>
<br>
End<br>
<br>
Public Sub GridView1_Arrange()<br>
<br>
   GridView1.Columns[0].Width = (GridView1.ClientWidth - iFixedColumnsWidth)<br>
<br>
End<br>
[/code]<br>
<br>
But not with the Expand property.<br>
<br>
<br>
___<br>
Lee<br></blockquote><div><br></div><div>Now I understand what you mean and this should work:<br><br>Public Sub Form_Open()<br><br>  Dim Headers As String[] = ["0123456789", "0123456789", "0123456789", "0123456789"]<br><br>  With GridView1<br>    .AutoResize = True<br>    .Header = GridView.Horizontal<br>  End With<br><br>  GridView1.Rows.Count = 1<br>  GridView1.Columns.Count = Headers.Count<br>  For i As Integer = 0 To Headers.Max<br>    GridView1.Columns[i].Title = Headers[i]<br>    GridView1[0, i].Text = String(30, "*")<br>  Next<br>   GridView1.Columns[0].Expand = True<br>   GridView1.Columns[1].Expand = True<br>   GridView1.Columns[2].Expand = True<br>   GridView1.Columns[3].Expand = True<br>   'GridView1.Columns[0].Width = -1<br><br>End <br><br>Regards<br>Gianluigi<br></div></div></div></div></div>