Adding New Custom Object with button click

  • Thread starter Thread starter Shan1986
  • Start date Start date
S

Shan1986

Guest
Hallo,

I have Class Customer and it has a custom object Order.

In the form i have


Public customerList As New BindingList(Of Customer)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CustomersBindingSource.DataSource = customerList
End Sub


On button click i could add new customer like this

CustomersBindingSource.Add(New Customer("Customer1", "Company1", "City1", "Region1", "Country1"))



Now i would like to add new Order with button click to the current customer. I can add it in datagridview but with button i dont know how to add new order to current customer in the bindingsource.

OrderBindingSource.Datasource = CustomersBindingSource
OrderBindingSource.DataMember = "Order"


i tried to add like above with customerbindingsource but it does not work



Thanks

Continue reading...
 
Back
Top