<div dir="ltr"><div dir="ltr"><div dir="ltr">To be clearer:<br>It all depends on how AutoResize is set, for Expand to work fine, it must be set to true.<br>Try this which it seems simpler:</div><div dir="ltr"><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> 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><br>End<br>'-------------------------------------------<br><br>Regards<br>Gianluigi<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno dom 3 feb 2019 alle ore 12:32 Denis Crowther <<a href="mailto:denisc@exemail.com.au">denisc@exemail.com.au</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">Hmmm, so that made me curious.. :-)<br>
<br>
So I threw a new GridView on a form and found that expand in either of <br>
these works as it should.<br>
<br>
I did notice that all the columns need to be sized at the same time.<br>
<br>
'---------------------------------------------<br>
Public Sub Form_Open()<br>
<br>
Dim iWide As Integer = 65<br>
<br>
With GridView1<br>
.Columns.Count = 3<br>
.Header = GridView.Horizontal<br>
<br>
' .Columns[0].Width = iWide<br>
' '-1 here makes the col really small<br>
' '.Columns[1].Width = -1<br>
' .Columns[1].Expand = True<br>
' .Columns[2].Width = iWide<br>
End With<br>
<br>
<br>
For x As Integer = 1 To 10<br>
GridView1.Rows.Count += 1<br>
GridView1[x - 1, 0].Text = "test: " & x<br>
GridView1[x - 1, 1].Text = "rwrggrg rgrgreg reg erg reg last"<br>
GridView1[x - 1, 2].Text = Str(x)<br>
Next<br>
<br>
End<br>
'---------------------------------------------<br>
Public Sub GridView1_Arrange()<br>
<br>
Dim iWide As Integer = 65<br>
With GridView1<br>
.Columns[0].Width = iWide<br>
.Columns[1].Expand = True<br>
'-1 here resized the col to suit the data as expected<br>
'.Columns[1].Width = -1<br>
.Columns[2].Width = iWide<br>
End With<br>
End<br>
'---------------------------------------------<br>
<br>
Regards<br>
Denis<br>
<br>
On 3/2/19 11:03 am, T Lee Davidson wrote:<br>
> Thank you for that, Denis. But, even that didn't work for me.<br>
> <br>
> I can accomplish what I need by mathematically resizing the <br>
> variable-width column in relation to the combined widths of my <br>
> fixed-width columns.<br>
> <br>
> <br>
> ___<br>
> Lee<br>
> <br>
> <br>
> On 2/2/19 6:39 PM, Denis Crowther wrote:<br>
>> Sure Lee,<br>
>><br>
>> Copied straight from a working program.<br>
>><br>
>> I 'think' the trick is to use the Arrange event.<br>
>> Using -1 didn't work for me in the arrange event,<br>
>> I haven't tested it anywhere else yet.<br>
>><br>
>><br>
>> Public Sub tblTest_Arrange()<br>
>><br>
>> With tblTest<br>
>> .Columns[0].Width = 0<br>
>> '.Columns[1].Width = 150<br>
>> .Columns[1].Expand = True<br>
>> .Columns[2].Width = 50<br>
>> End With<br>
>><br>
>> End<br>
>><br>
>> Regards<br>
>> Denis<br>
> <br>
> ----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>