Hello

i have a form bounded to a DataSet and i have several combobox's in the
form.

when i use
Bc.Position = Bc.Position + 1
it moves to the next record in the DataSet, and all the combobox's that are
bound to other tables in the dataset are updated too.

problem is when the bc.position = 0 (first record) is selected the textbox's
are updated correctly the combobox's are displaying the first record of the
bonded table and not the value that is in in that record.

is there i am missing?

Thnaks

Re: BindingContext by Miha

Miha
Fri Nov 21 06:28:02 CST 2003

Hi Ruben,

"Ruben Alves" <ruben@terceirasoft.com> wrote in message
news:3fbd7145$0$25687$a729d347@news.telepac.pt...
> Hello
>
> i have a form bounded to a DataSet and i have several combobox's in the
> form.
>
> when i use
> Bc.Position = Bc.Position + 1
> it moves to the next record in the DataSet, and all the combobox's that
are
> bound to other tables in the dataset are updated too.

You do realise that you are binding against DataTable and not DataSet,
right.
When you change position you change it only for one DataTable.
What is Bc anyway?

> problem is when the bc.position = 0 (first record) is selected the
textbox's
> are updated correctly the combobox's are displaying the first record of
the
> bonded table and not the value that is in in that record.

Hard to tell without more info.
How are you binding controls?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com



Re: BindingContext by Ruben

Ruben
Fri Nov 21 14:52:45 CST 2003

i have a dataset with 5 tables
"Registos" - Master Table
"Clientes"
"Funcionarios"
"Equipamentos"
"Tecnicos"

i have 1 combobox for each tables in the form and some texbox's.
each combobox is bonded to the table "Registos" and gets the list from a
diferent table.
The other tables are related tables (like ID, EmpName) and than just use the
ID to relate the data (Foreign Key)
Me.ComboBox1.DataBindings.Add(New
System.Windows.Forms.Binding("SelectedValue", Me.DsRegistos1,
"REGISTOS.NCLI"))

Me.ComboBox1.DataSource = Me.DsRegistos1.CLIENTES

Me.ComboBox1.DisplayMember = "NOME"

Me.ComboBox1.Location = New System.Drawing.Point(112, 32)

Me.ComboBox1.Name = "ComboBox1"

Me.ComboBox1.Size = New System.Drawing.Size(344, 21)

Me.ComboBox1.TabIndex = 28

Me.ComboBox1.ValueMember = "ID"

then i aded the code

Dim bc As BindingManagerBase

bc = Me.BindingContext(DsRegistos1, "REGISTOS")

and i have code to move the bc.position


if the bc.position is 0 the the "SelectedValue" of the combobox is 0 and if
the
the bc.position is other value the foreign key is selected right.

it is strange.

i am to English - bad writing !
Ruben