Notifications
Clear all
[Closed] DataGridView and ComboBoxes
Oct 23, 2020 10:02 am
Should be simple… user changes the dropdown box… press the button, it should print the value in the box. But you need to click to deactivate the dropdown list to make it work… Anyone got a trick to make this behave like it should do?
try(destroyDialog ro_Test)catch()
rollout ro_Test "Test" width:800
(
dotNetControl gv_Test "System.Windows.Forms.DataGridView" width:790 height:300 offset:[-8,0]
button btn_test "Test"
on ro_Test open do
(
gv_Test.SelectionMode = gv_Test.SelectionMode.FullRowSelect
gv_Test.AllowUserToAddRows = false
dnNewColumn = dotNetObject "System.Windows.Forms.DataGridViewCheckBoxColumn"
dnNewColumn.HeaderText = "Export"
gv_Test.columns.add dnNewColumn
dnNewColumn = dotNetObject "System.Windows.Forms.DataGridViewComboBoxColumn"
dnNewColumn.HeaderText = "Category"
dnNewColumn.items.AddRange (#("A","B","C"))
gv_Test.columns.add dnNewColumn
gv_Test.Rows.Add #(True, "A")
gv_Test.Rows.Add #(True, "A")
)
on btn_test pressed do
(
messageBox ("row1:" + (gv_Test.rows.item[0].cells.item[1].value) as string)
messageBox ("row2:" + (gv_Test.rows.item[1].cells.item[1].value) as string)
)
)
createDialog ro_Test
2 Replies
Oct 23, 2020 10:02 am
Perhaps there are other ways, but try:
on btn_test pressed do
(
ro_Test.gv_Test.EndEdit()
messageBox ("row1:" + (gv_Test.rows.item[0].cells.item[1].value) as string)
messageBox ("row2:" + (gv_Test.rows.item[1].cells.item[1].value) as string)
)
Oct 23, 2020 10:02 am
Yeah that seems to do the trick… I remember trying a bunch of things to do with ending cell edits before but that works nicely.
Thanks