How to data binding?

master_2013

Active member
Joined
Jul 8, 2013
Messages
41
Programming Experience
Beginner
Can anyone help me on data bindings topic in vb.net with ms access i just want to display some vale through combo box in a from which taken from some other table in ms access

like i have a table name "pro" in ms access and having columns product name,price,quantity,item no & amount
and another table "products" having product name,name,date of issue,quantity,price,grand total & invoice number


i want to display in my product issue form from "products" table and combo box fill on "price","quantity","product name","item no" rom "pro" table

i have already binding with pro form but it only shows the first one in combo box not the others which i update in "pro" table through add products form
 

Attachments

  • ISSUE.jpg
    ISSUE.jpg
    127.8 KB · Views: 35
  • ADD.jpg
    ADD.jpg
    29.6 KB · Views: 35
First of all, the fact that you're using Access is irrelevant. Data is data and where it came from has no significance when binding. As an example, let's say that you have a Person table and a Gender table and the GenderID column is the primary key in Gender and a foreign key in Person. Now, when editing Person records, you might have two TextBoxes for GivenName and FamilyName and a ComboBox for GenderID and you want that ComboBox to display the GenderName from the Gender table. In that case, binding in code would look something like this:
personBindingSource.DataSource = myDataSet.Tables("Person")
genderBindingSource.DataSource = myDataSet.Tables("Gender")

With genderComboBox
    .DisplayMember = "GenderName"
    .ValueMember = "GenderID"
    .DataSource = genderBindingSource
End With

givenNameTextBox.DataBindings.Add("Text", personBindingSource, "GivenName")
familyNameTextBox.DataBindings.Add("Text", personBindingSource, "FamilyName")
genderComboBox.DataBindings.Add("SelectedValue", genderBindingSource, "GenderID")
 
Back
Top