A
Aziz
1. I have a shopping basket DataGrid with a list of products. What I
want to do is when the user clicks on a row, a button will become
visible/be created that allows user to edit the quantity. The button
will be dynamic and always show up on the same Y-axis position as the
selected row.
So, how do I get back the X, Y co-ordinates of a specific row in a
datagrid relative to the form?
2. I managed to change individual column width using:
dgrProductSearch.DataSource = dtProductSearch
'Sets DataGrid column width individually
Dim dgtsProductSearch As DataGridTableStyle = New
DataGridTableStyle
dgtsProductSearch.MappingName = "ProductSearch"
dgrProductSearch.TableStyles.Add(dgtsProductSearch)
dgtsProductSearch.GridColumnStyles(0).Width = 90
dgtsProductSearch.GridColumnStyles(1).Width = 410
dgtsProductSearch.GridColumnStyles(2).Width = 90
This code is attached to a Search button that will display the relevant
product in the DataGrid.
However, if the button is pressed and the code executes again I get:
"The data grid table styles collection already contains a table style
with the same mapping name"
If I add this to the code above I don't get the above error but niether
does the column width change:
dgtsProductSearch.MappingName = ""
dgtsProductSearch.Dispose()
want to do is when the user clicks on a row, a button will become
visible/be created that allows user to edit the quantity. The button
will be dynamic and always show up on the same Y-axis position as the
selected row.
So, how do I get back the X, Y co-ordinates of a specific row in a
datagrid relative to the form?
2. I managed to change individual column width using:
dgrProductSearch.DataSource = dtProductSearch
'Sets DataGrid column width individually
Dim dgtsProductSearch As DataGridTableStyle = New
DataGridTableStyle
dgtsProductSearch.MappingName = "ProductSearch"
dgrProductSearch.TableStyles.Add(dgtsProductSearch)
dgtsProductSearch.GridColumnStyles(0).Width = 90
dgtsProductSearch.GridColumnStyles(1).Width = 410
dgtsProductSearch.GridColumnStyles(2).Width = 90
This code is attached to a Search button that will display the relevant
product in the DataGrid.
However, if the button is pressed and the code executes again I get:
"The data grid table styles collection already contains a table style
with the same mapping name"
If I add this to the code above I don't get the above error but niether
does the column width change:
dgtsProductSearch.MappingName = ""
dgtsProductSearch.Dispose()