binding class property to datatable?

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

Shan1986

Guest
Hallo,

previously i had a property not inside of a class and i used to bind to a datatable in a following way

Form1.DataBindings.Add("Name", Contact_BS, dtName, True, DataSourceUpdateMode.OnPropertyChanged)

Where , Name is a public property and Contact_BS is a binding source of the data table contact, dtName is column in a data table contact.

Now i have a class called contact and want to bind Name in contact class to the data table. I have tried following but i am getting error.

Public Contacts as Contact

Public Class Contact

Private _Name As String
Private _Ph As Integer

Public Property Name As String
Get
Return _Name
End Get
Set
_Name = Value
OnPropertyChanged()
End Set
End Property

Public Property Ph As integer
Get
Return _Ph
End Get
Set
_Ph = Value
OnPropertyChanged()
End Set
End Property


End class


Form1.DataBindings.Add("Contacts.Name", Contact_BS, dtName, True, DataSourceUpdateMode.OnPropertyChanged)

Thanks

Continue reading...
 
Back
Top