vb.net DataGridView last row heigth not work

59 Views Asked by At
Dim lr As Integer = DataListInfo1.Rows.Count - 1
Dim rowHeigthSum As Integer

For n = 0 To lr
    rowHeigthSum += DataListInfo1.Rows(n).Height
Next n

lr = DataListInfo1.Rows.Count - 1
DataListInfo1.Rows(lr).Height = CInt(DataListInfo1.Height) - rowHeigthSum 

DataGridViewDisplay

I'm using vb.net 2022... what I want to do here is to change the height of the last row to fit the height of the DataGridView.

but not work, like the image below, but still like the image above.

note : DataListInfo1.Rows.Count = 4

lr = 2

rowHeghtSum = 87... DataListInfo1.Rows(0).Heght = 29... DataListInfo1.Rows(1).Heght = 29... DataListInfo1.Rows(2).Heght = 29...

last row in DataGridViw (DataListInfo1.Rows(3).Heght = 17)

DataGridViw Heght (DataListInfo1.Heght = 215)

need to change height of last row in DataGridViw => DataListInfo1.Rows(3).Heght from 17 to 128 to fit to bottom of DataGridViw but the last row height still in 17..

DataGridViewLastRowHeigth

BorangThailand

0

There are 0 best solutions below