ComboBox in DataGrid

  • Thread starter Thread starter Herfried K. Wagner [MVP]
  • Start date Start date
Hello All,

I have a prob, i have a Access Datatbase with 4 Feilds.

Feild3 in Table1 is a Lookup to Feild2 in Table2, how do i get a combobox in
my datagrid to look at Feild2 in Table2?

Well more to the point how do i get a combobox to start with?

Also how would i bind my Standered ComboBox to this type of thing?

Ta
Merlin
 
Sorry i think i`ve explained this wrong. I`ll try a bit better:

As I said my SitesID Feild in ArcirisUsers Table is a Lookup to the Sites
Feild in my Sites Table, how do i get a combobox to look at the Sites Feild
in the Sites Table?

I`ve set my datasource to dsArcirisUsers which I built from the Following
SQL Statement in my Data Adapter:

SELECT ArcirisUsers.Usersname, ArcirisUsers.POSID,
ArcirisUsers.POSAccess, ArcirisUsers.[Password], ArcirisUsers.LiveDate,
ArcirisUsers.BomID,
ArcirisUsers.BomAcc, Sites.[Site Name],
ArcirisUsers.ArcirisUsersID, Sites.SitesID
FROM ArcirisUsers INNER JOIN
Sites ON ArcirisUsers.SitesID = Sites.SitesID

However when I click on the ComboBox it lists the sites multiple times, as
it is looking at the Feild in ArcirisUsers, not in Sites if you get what i
mean?

Do I need to create a seperate Dataadapter and Dataset for the Sites table?

Cheers
Si

When I assign
 
Hi Merlin,

If you want to select 2 tables, than you have to do that.

But maybe it is better to tell us what you want to archieve than send us a
select statement.

This is not a SQL group do you know.

(However I think that what you want can be done and can normaly be answered
in this newsgroup)

Cor
 
Cor,

I want to be able to in a ComboBox on a normal WinForm select it and pull a
list of all Sites, however my SitesID Feild in ArcUsers Table is a Lookup to
the Sites Feild in my Sites Table.

A Colleuge has just told me he thinks its something to do with binding(s)

My table is as follows:

ARCUSERSTABLE:

ARCUSERSID(PrimaryKey)
Name
BOMID
TILLID
SitesTABLE
SITEID ------ This has a Relationship to and looks up all feilds in
Sitename --- SITEID(PrimaryKey)

SITENAME

CONTACT

I created for my Dataset the join etc etc all ok, seems to work ok, now i
just need to be able to have a combobox to select the site and update the
siteID in my Arcuserstable.

If i select my datasource as SiteID in my ArcirisUsers table i get many
repitions of the data as it is looking up all the feilds in SiteID of the
arcuserstable.

Many thanks for your help
Merlin

Feild in my Sites Table
 
Hi Merlin,

We go back,

From a filled combobox the user can select an item and if necessary use that
item or an associated value from that to select something else.

By instance it can be the start to get a selection from your database to
fill a new combobox from which the user select something and do something
with that item or its associated value.

Is that what you want to do?

Cor
 
yes i want a user to be able to click on the combobox and get a list of
Sites up

I think i need to do something like this when i fill the dataset but im not
sure:
combobox1.DataBindings.Add("Text", dsArcirisUsers, ArcirisUsers.SiteName")

Thanks You
Merlin
 
Also another thing looking at this, im using
DataAdapter1.fill(DatasetArcirisUsers)

Again i might be barking up the wrong tree but i noticed people talking
about filling the parent table first and then child table.

How would i do this? or wouldn`t i need to?

Thanks
Merlin
 
yes i need it to list all my sites which will change as new sites come on
thats why it need to lists all the sites in the Site table. I have around
200 sites all in all

Thanks so Far
Merlin
 
Back
Top