robertb_NZ
Well-known member
My program assigns a datagridview.Datasource with
Layoutnames is defined
In my test there are initially 4 members of the list, and dgvLayouts is displayed as expected with 4 rows, each with the fields of class LayoutElement. My program can manipulate the data in LayoutNames, for example swapping data in two rows, and this was reflected in the datagridview once I'd learned to use
However sometimes my program wants to add a new line to the grid. Logic for this case is: -
Although the debugger shows me that there are now 5 members of LayoutNames, the datagridview continues to display only 4 rows. How can I make it display the correct number?
I have experimented with
In Visual Studio dgvlayouts has default property AllowUserToAddRows=True
I've looked through the properties of dgvlayouts, but nothing leaps out at me as possibly wrong, or worth experimenting with.
Can anybody help?
Thank you, Robert.
dgvLayouts.DataSource = Layoutnames
Layoutnames is defined
Property Layoutnames As New List(Of LayoutElement)
In my test there are initially 4 members of the list, and dgvLayouts is displayed as expected with 4 rows, each with the fields of class LayoutElement. My program can manipulate the data in LayoutNames, for example swapping data in two rows, and this was reflected in the datagridview once I'd learned to use
dgvLayouts.Refresh()
However sometimes my program wants to add a new line to the grid. Logic for this case is: -
If new line wanted Then
LE = new LayoutElement
Assign values to LE
Layoutnames.add(LE)
dgvlayouts.refresh
Assign values to LE
Layoutnames.add(LE)
dgvlayouts.refresh
Although the debugger shows me that there are now 5 members of LayoutNames, the datagridview continues to display only 4 rows. How can I make it display the correct number?
I have experimented with
dgvlayouts.rows.add(...)
but this throws an error ("rows can't be programmatically added ... when the control is data-bound").In Visual Studio dgvlayouts has default property AllowUserToAddRows=True
I've looked through the properties of dgvlayouts, but nothing leaps out at me as possibly wrong, or worth experimenting with.
Can anybody help?
Thank you, Robert.