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