By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

Binding ComboBox

P: n/a
I'm attempting to bind a combobox to store the values in
tblProblems.VersionID and display the Version value from the tblVersions.
The VersionID field is a foreign key to the ID in tblVersions. Currently I
have the combobox displaying the versions in the dropdown which is what I
need but when I select a different version it is displayed for every record
(apparently not bound to the value of VersionID in tblProblems.

Documentation that I have is confusing and doesn't really address my
situation of using the validation table. I routinely use this technique in
Microsoft Access but the control binds very differently.

TABLES
--------------
tblProblems.VersionID (1)

tblVersions.ID (1)
tblVersions.Version (1.0.1)

RELATIONSHIPS
-------------
ProblemsVersionIDColumn = DataSet11.Tables("tblProblems").Columns("VersionID ")
VersionsKeyColumn = DataSet11.Tables("tblVersions").Columns("ID")
problemsversions = New DataRelation("problemsversions",
ProblemsVersionIDColumn, VersionsKeyColumn)
DataSet11.Relations.Add(problemsversions)

COMBOBOX PROPERTIES
---------------------
DataSource tblVersions
DisplayMember - Version
ValueMember - ID

DataBindings.SelectedItem (None)
DataBindings.SelectedValue (None)
DataBindings.Text (DataSet11 - tblProblems.VersionID)
--
Steve King
Mar 6 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Steve,

And what do you need?

Cor
"Steve King" <St*******@discussions.microsoft.com> schreef in bericht
news:C4**********************************@microsof t.com...
I'm attempting to bind a combobox to store the values in
tblProblems.VersionID and display the Version value from the tblVersions.
The VersionID field is a foreign key to the ID in tblVersions. Currently
I
have the combobox displaying the versions in the dropdown which is what I
need but when I select a different version it is displayed for every
record
(apparently not bound to the value of VersionID in tblProblems.

Documentation that I have is confusing and doesn't really address my
situation of using the validation table. I routinely use this technique
in
Microsoft Access but the control binds very differently.

TABLES
--------------
tblProblems.VersionID (1)

tblVersions.ID (1)
tblVersions.Version (1.0.1)

RELATIONSHIPS
-------------
ProblemsVersionIDColumn =
DataSet11.Tables("tblProblems").Columns("VersionID ")
VersionsKeyColumn = DataSet11.Tables("tblVersions").Columns("ID")
problemsversions = New DataRelation("problemsversions",
ProblemsVersionIDColumn, VersionsKeyColumn)
DataSet11.Relations.Add(problemsversions)

COMBOBOX PROPERTIES
---------------------
DataSource tblVersions
DisplayMember - Version
ValueMember - ID

DataBindings.SelectedItem (None)
DataBindings.SelectedValue (None)
DataBindings.Text (DataSet11 - tblProblems.VersionID)
--
Steve King

Mar 6 '06 #2

P: n/a
when I select a different version it is displayed for every record
(apparently not bound to the value of VersionID in tblProblems.

When I move the form from record to record I expected the relationship to
cause the combobox to display the version number related to the record being
viewd, and it doesn't.

tblProblems.VersionID -> FORM (COMBO) <-- tblVersions.ID (Value),
tblVersions.Version (Display)
--
Steve King
"Cor Ligthert [MVP]" wrote:
Steve,

And what do you need?

Cor
"Steve King" <St*******@discussions.microsoft.com> schreef in bericht
news:C4**********************************@microsof t.com...
I'm attempting to bind a combobox to store the values in
tblProblems.VersionID and display the Version value from the tblVersions.
The VersionID field is a foreign key to the ID in tblVersions. Currently
I
have the combobox displaying the versions in the dropdown which is what I
need but when I select a different version it is displayed for every
record
(apparently not bound to the value of VersionID in tblProblems.

Documentation that I have is confusing and doesn't really address my
situation of using the validation table. I routinely use this technique
in
Microsoft Access but the control binds very differently.

TABLES
--------------
tblProblems.VersionID (1)

tblVersions.ID (1)
tblVersions.Version (1.0.1)

RELATIONSHIPS
-------------
ProblemsVersionIDColumn =
DataSet11.Tables("tblProblems").Columns("VersionID ")
VersionsKeyColumn = DataSet11.Tables("tblVersions").Columns("ID")
problemsversions = New DataRelation("problemsversions",
ProblemsVersionIDColumn, VersionsKeyColumn)
DataSet11.Relations.Add(problemsversions)

COMBOBOX PROPERTIES
---------------------
DataSource tblVersions
DisplayMember - Version
ValueMember - ID

DataBindings.SelectedItem (None)
DataBindings.SelectedValue (None)
DataBindings.Text (DataSet11 - tblProblems.VersionID)
--
Steve King


Mar 6 '06 #3

P: n/a
Steve,

I thought that this is the part where I never could use the relations.

Can you try this sample.

http://www.vb-tips.com/default.aspx?...1-af26354b1fa0

This is three deep and using a datagrid, however that is in my opinion a
detail.
Cor

"Steve King" <St*******@discussions.microsoft.com> schreef in bericht
news:88**********************************@microsof t.com...
when I select a different version it is displayed for every record
(apparently not bound to the value of VersionID in tblProblems.

When I move the form from record to record I expected the relationship to
cause the combobox to display the version number related to the record
being
viewd, and it doesn't.

tblProblems.VersionID -> FORM (COMBO) <-- tblVersions.ID (Value),
tblVersions.Version (Display)
--
Steve King
"Cor Ligthert [MVP]" wrote:
Steve,

And what do you need?

Cor
"Steve King" <St*******@discussions.microsoft.com> schreef in bericht
news:C4**********************************@microsof t.com...
> I'm attempting to bind a combobox to store the values in
> tblProblems.VersionID and display the Version value from the
> tblVersions.
> The VersionID field is a foreign key to the ID in tblVersions.
> Currently
> I
> have the combobox displaying the versions in the dropdown which is what
> I
> need but when I select a different version it is displayed for every
> record
> (apparently not bound to the value of VersionID in tblProblems.
>
> Documentation that I have is confusing and doesn't really address my
> situation of using the validation table. I routinely use this
> technique
> in
> Microsoft Access but the control binds very differently.
>
> TABLES
> --------------
> tblProblems.VersionID (1)
>
> tblVersions.ID (1)
> tblVersions.Version (1.0.1)
>
> RELATIONSHIPS
> -------------
> ProblemsVersionIDColumn =
> DataSet11.Tables("tblProblems").Columns("VersionID ")
> VersionsKeyColumn = DataSet11.Tables("tblVersions").Columns("ID")
> problemsversions = New DataRelation("problemsversions",
> ProblemsVersionIDColumn, VersionsKeyColumn)
> DataSet11.Relations.Add(problemsversions)
>
> COMBOBOX PROPERTIES
> ---------------------
> DataSource tblVersions
> DisplayMember - Version
> ValueMember - ID
>
> DataBindings.SelectedItem (None)
> DataBindings.SelectedValue (None)
> DataBindings.Text (DataSet11 - tblProblems.VersionID)
> --
> Steve King


Mar 6 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.