M
Martin Williams
I have inserted a combobox into a datagrid cell. I am having difficulty
getting the cell to retain the combobox selection. When I leave the cell,
it remains empty.
Here is the code, based on the Microsoft Article Q323167:
public mycombo as new combobox
FORM1_LOAD
mycombo.datasource = datset.tables("Inventory")
mycombo.displaymember = "Title"
mycombo.visible = false
SUB DATAGRID1_PAINT
if datagrid1.currentcell.columnnumber = 2 or _
datagrid1.currentcell.columnnumber = 3 then
mycombo.width = datagrid1.getcurrentcellbounds.width
end if
SUB CTRLS_TEXTCHANGED
if datagrid1.currentcell.columnnumber = 2 or _
datagrid1.currentcell.columnnumber = 3 then
datagrid1.item(datagrid1.currentcell) = mycombo.text
end if
SUB DATAGRID1_CURRENTCELLCHANGED
if datagrid.currentcell.columnnumber = 2 then
mycombo.visible = false
mycombo.width = 0
mycombo.left = datagrid1.getcurrentcellbounds.left
mycombo.top = datagrid1.getcurrentcellbounds.top
mycombo.text = datagrid1.item(datagrid1.currentcell) & ""
mycombo.visible = true
else
mycombo.visible = false
mycombo.width = 0
end if
SUB DATAGRID1_SCROLL
mycombo.visible = false
mycombo.width = 0
SUB DATAGRID1_CLICK
mycombo.visible = false
mycombo.width = 0
Thanks for all responses.
Regards,
Martin Williams
getting the cell to retain the combobox selection. When I leave the cell,
it remains empty.
Here is the code, based on the Microsoft Article Q323167:
public mycombo as new combobox
FORM1_LOAD
mycombo.datasource = datset.tables("Inventory")
mycombo.displaymember = "Title"
mycombo.visible = false
SUB DATAGRID1_PAINT
if datagrid1.currentcell.columnnumber = 2 or _
datagrid1.currentcell.columnnumber = 3 then
mycombo.width = datagrid1.getcurrentcellbounds.width
end if
SUB CTRLS_TEXTCHANGED
if datagrid1.currentcell.columnnumber = 2 or _
datagrid1.currentcell.columnnumber = 3 then
datagrid1.item(datagrid1.currentcell) = mycombo.text
end if
SUB DATAGRID1_CURRENTCELLCHANGED
if datagrid.currentcell.columnnumber = 2 then
mycombo.visible = false
mycombo.width = 0
mycombo.left = datagrid1.getcurrentcellbounds.left
mycombo.top = datagrid1.getcurrentcellbounds.top
mycombo.text = datagrid1.item(datagrid1.currentcell) & ""
mycombo.visible = true
else
mycombo.visible = false
mycombo.width = 0
end if
SUB DATAGRID1_SCROLL
mycombo.visible = false
mycombo.width = 0
SUB DATAGRID1_CLICK
mycombo.visible = false
mycombo.width = 0
Thanks for all responses.
Regards,
Martin Williams