M
Martin Horn
Hi,
I want to use databinding on a property for a class that I have created, but
I can't make it work. Below is a contrived example to illustrate the
problem.
It seems that I can't databind properties that I have created, is there a
way to do this?
Thanks,
Martin.
Public Class Form1
Public Class Class1
Inherits Button
Public MyValue As String = "Default Value"
End Class
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim t As New Class1
' This line would work as expected
' ----------------------------------
' TextBox1.DataBindings.Add("Text", t, "Size")
' This line causes runtime error:
' Cannot bind to property or column MyValue on DataSource.
' Parameter name: dataMember
' -------------------------------------------------------------
TextBox1.DataBindings.Add("Text", t, "MyValue")
End Sub
End Class
I want to use databinding on a property for a class that I have created, but
I can't make it work. Below is a contrived example to illustrate the
problem.
It seems that I can't databind properties that I have created, is there a
way to do this?
Thanks,
Martin.
Public Class Form1
Public Class Class1
Inherits Button
Public MyValue As String = "Default Value"
End Class
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim t As New Class1
' This line would work as expected
' ----------------------------------
' TextBox1.DataBindings.Add("Text", t, "Size")
' This line causes runtime error:
' Cannot bind to property or column MyValue on DataSource.
' Parameter name: dataMember
' -------------------------------------------------------------
TextBox1.DataBindings.Add("Text", t, "MyValue")
End Sub
End Class