ComboBox in Bound DataGrid (VB 2003)


A

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.
 
Ad

Advertisements

S

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:
 
Ad

Advertisements

C

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top