Well, after much experimenting, I got it to work. The following needs to be
added to FORM1_LOAD:
AddHandler MyCombo.SelectionChangeCommitted, AddressOf Ctrls_Textchanged
"Ken Tucker [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Yes.
>
> Ken
> -------------------
> "Martin Williams" <(E-Mail Removed)> wrote in message
> news:J8qdnUlnD7ZfeEaiRVn-(E-Mail Removed)...
> > Is that the only way to get it to work? I really wanted a bound combobox
> > within the datagrid.
> >
> > Regards,
> > Martin Williams
> >
> > "Ken Tucker [MVP]" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi,
> > >
> > > You need to add the items to the combobox manually.
> > >
> > > Ken
> > > ------------------------
> > > "Martin Williams" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|