PC Review


Reply
Thread Tools Rate Thread

datagrid combobox problem

 
 
Martin Williams
Guest
Posts: n/a
 
      13th Dec 2003
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


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      14th Dec 2003
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
>
>



 
Reply With Quote
 
Martin Williams
Guest
Posts: n/a
 
      14th Dec 2003
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
> >
> >

>
>



 
Reply With Quote
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      14th Dec 2003
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
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Martin Williams
Guest
Posts: n/a
 
      14th Dec 2003
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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid combobox.. problem =?Utf-8?B?S2luYQ==?= Microsoft Dot NET Framework Forms 1 20th Apr 2005 09:39 PM
ComboBox in DataGrid problem =?Utf-8?B?S2FyaW4=?= Microsoft Dot NET Framework Forms 1 2nd Nov 2004 03:37 PM
Update Problem with Combobox DataGrid =?Utf-8?B?bmFkZWVt?= Microsoft Dot NET Framework Forms 0 2nd Jun 2004 11:11 AM
Update Problem with Combobox DataGrid =?Utf-8?B?bmFkZWVt?= Microsoft Dot NET Framework Forms 2 31st May 2004 10:06 AM
minor problem from combobox in datagrid jaYPee Microsoft VB .NET 0 25th Apr 2004 11:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:58 AM.