I created a local DB file [DB_Product.mdf] and a DataSet [DB_ProductDataSet.xsd]
Inside the db, I created a table [TB_PartSpec] that contains: Id, PartName, PartNumber, PressureLoLim, ....
On the MainForm, an Add/Change button will ShowDialog of Page2, where you can add/change Part specs.
Also on the mainform is a combobox to select PartName. The combobox is bound to the table as shown below:
In order to display part details associated with the PartName selected from the combobox, I use its IndexChanged event:
If ComboBox1.SelectedValue IsNot Nothing Then
Label2.Text = DB_ProductDataSet.TB_PartSpec.FindById(ComboBox1.SelectedValue).PartNumber
Label3.Text = DB_ProductDataSet.TB_PartSpec.FindById(ComboBox1.SelectedValue).PressureLoLim
Label4.Text = DB_ProductDataSet.TB_PartSpec.FindById(ComboBox1.SelectedValue).PressureHiLim
End If
This works for me, and the values will be written to PLC later, but I wonder if you would have a better way to handle this.
TIA.