Hello,
This is using the Compact Frame 2.0
I have found some code that seems to work. However, the idea of the grid is for the user to keep adding new products to the datagrid. Even though the columns that are needed are added ok. When the user attempts to add a second row there is an error. "Value does not fall within the expected range". This happens each time, after the first one has been successfully added. 2nd one onwards.
I thought it might be the tblStyle object, but as I am creating a new one each time, I am surprised to get this error.
Many thanks,
Steve
This is using the Compact Frame 2.0
I have found some code that seems to work. However, the idea of the grid is for the user to keep adding new products to the datagrid. Even though the columns that are needed are added ok. When the user attempts to add a second row there is an error. "Value does not fall within the expected range". This happens each time, after the first one has been successfully added. 2nd one onwards.
I thought it might be the tblStyle object, but as I am creating a new one each time, I am surprised to get this error.
Many thanks,
Steve
Code:
Dim tblStyle As New DataGridTableStyle()
tblStyle.MappingName = "OrderDetail"
Dim column As New DataGridTextBoxColumn()
column.MappingName = "Beverage"
column.HeaderText = "Beverage"
tblStyle.GridColumnStyles.Add(column)
column = New DataGridTextBoxColumn()
column.MappingName = "BeverageQty"
column.HeaderText = "Quantity"
tblStyle.GridColumnStyles.Add(column)
grdBeverages.TableStyles.Add(tblStyle) 'Error - "Value does not fall within the expected range"
grdBeverages.DataSource = DS.OrderDetail.DefaultView