Home All Groups Group Topic Archive Search About

ComboBox in Bound DataGrid (VB 2003)

Author
13 Apr 2006 8:50 AM
Aziz
Hello, I'm using a DataGrid to add a product to an order. I would like
to fill in a child field (a foreign key) by bringing up a ComboBox
inside the the datagrid cell (like in the latest Northwind database) so
that it shows all available options and I can select the right one.
E.g. in the Orders datagrid I can simply select the product to order by
using a dropdown list

I'm using access 2003 and a VB .NET 2003. I need a solution that is
quick to do and if possible can be done without having to add too much
code (time is short). Thanks.

Author
13 Apr 2006 9:25 AM
Cor Ligthert [MVP]
Azis,

There is as well one which is a little bit more difficult on our website.

http://www.vb-tips.com/default.aspx?ID=1eb83247-7464-467e-a9dd-faf92f41f563

I hope this helps,

Cor

Show quoteHide quote
"Aziz" <aziz***@googlemail.com> schreef in bericht
news:1144918217.654024.150620@g10g2000cwb.googlegroups.com...
> Hello, I'm using a DataGrid to add a product to an order. I would like
> to fill in a child field (a foreign key) by bringing up a ComboBox
> inside the the datagrid cell (like in the latest Northwind database) so
> that it shows all available options and I can select the right one.
> E.g. in the Orders datagrid I can simply select the product to order by
> using a dropdown list
>
> I'm using access 2003 and a VB .NET 2003. I need a solution that is
> quick to do and if possible can be done without having to add too much
> code (time is short). Thanks.
>
Author
13 Apr 2006 11:39 AM
Aziz
Thanks. I will give it a try.
Author
15 Apr 2006 4:35 PM
steven
Hello,

I'm having the same problem as Azis. I have implemented your code, and
it worked well, except for one thing: if I change the value of the cell
with an item from the combobox, I always get  DBNull instead of the
combobox item value:

Dim dt As Datatable
Dim dr As Datarow
Dim o As Object
dt = CType(DGMallen.DataSource, DataView).Table
For Each dr In dt.Rows
    o = dr.Item("combo")        'o IS ALWAYS DBNULL
End For

Any suggestions?

Thank you very much

Steven

Cor Ligthert [MVP] schreef:
Show quoteHide quote
> Azis,
>
> There is as well one which is a little bit more difficult on our website.
>
> http://www.vb-tips.com/default.aspx?ID=1eb83247-7464-467e-a9dd-faf92f41f563
>
> I hope this helps,
>
> Cor
>
> "Aziz" <aziz***@googlemail.com> schreef in bericht
> news:1144918217.654024.150620@g10g2000cwb.googlegroups.com...
>> Hello, I'm using a DataGrid to add a product to an order. I would like
>> to fill in a child field (a foreign key) by bringing up a ComboBox
>> inside the the datagrid cell (like in the latest Northwind database) so
>> that it shows all available options and I can select the right one.
>> E.g. in the Orders datagrid I can simply select the product to order by
>> using a dropdown list
>>
>> I'm using access 2003 and a VB .NET 2003. I need a solution that is
>> quick to do and if possible can be done without having to add too much
>> code (time is short). Thanks.
>>
>
>
Author
15 Apr 2006 5:30 PM
Cor Ligthert [MVP]
Steven,

It is better to open forever a new question although this seems easier.
Trying to help you.

> For Each dr In dt.Rows
> o = dr.Item("combo") 'o IS ALWAYS DBNULL
> End For
>
I don't understand what you want to do with this.
what is dr.Item("combo").

"combo" should be a columnname in your datatable and I don't believe that.

You are in fact just looping through that datatable.

Maybe better that you make a new message. Than somebody else can probably
help you . I stop for today.

Cor