C
Codemonkey
Hi,
I'm developing a distributed App using .net remoting and have been having a
problem when trying to pass a Serializable MBV object after it has been
bound to controls on a windows form.
Example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<Serializable> Public Class Item
'*************************************************
' Name: Name of the item
'*************************************************
Private mName As String = ""
Public Event NameChanged As EventHandler
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal Value As String)
mName = Value
RaiseEvent NameChanged(Me, New EventArgs())
End Set
End Property
End Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The above code snippet defines a simple MarshalByValue class that has a
"Name" Property. The property has all the extra stuff needed for databinding
(Event etc. - Please let me know if this is wrong)
If I create an instance of this class and pass it across to a remoting
function call, everything works fine... the object reaches the other side
without a problem.
However, If I bind the "Name" property to a textbox on a windows form with
the following code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
txtName.DataBindings.Add("Text", mItem, "Name")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The databinding works, but when I call the remoting function call as before,
the following exception is raised:
"The type System.Windows.Forms.BindToObject in Assembly
System.Windows.Forms, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable."
I could understand if "BindToObject" was a member of my "Item" class, but it
isn't, so why is the Remoting Framework attempting to serialize it?
Please help me with this. If you have the time, feel free to send me in the
right direction as far as databinding goes (I'm only going of an example I
found somewhere before).
Thanks in advance of any help,
Trev.
I'm developing a distributed App using .net remoting and have been having a
problem when trying to pass a Serializable MBV object after it has been
bound to controls on a windows form.
Example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<Serializable> Public Class Item
'*************************************************
' Name: Name of the item
'*************************************************
Private mName As String = ""
Public Event NameChanged As EventHandler
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal Value As String)
mName = Value
RaiseEvent NameChanged(Me, New EventArgs())
End Set
End Property
End Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The above code snippet defines a simple MarshalByValue class that has a
"Name" Property. The property has all the extra stuff needed for databinding
(Event etc. - Please let me know if this is wrong)
If I create an instance of this class and pass it across to a remoting
function call, everything works fine... the object reaches the other side
without a problem.
However, If I bind the "Name" property to a textbox on a windows form with
the following code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
txtName.DataBindings.Add("Text", mItem, "Name")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The databinding works, but when I call the remoting function call as before,
the following exception is raised:
"The type System.Windows.Forms.BindToObject in Assembly
System.Windows.Forms, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable."
I could understand if "BindToObject" was a member of my "Item" class, but it
isn't, so why is the Remoting Framework attempting to serialize it?
Please help me with this. If you have the time, feel free to send me in the
right direction as far as databinding goes (I'm only going of an example I
found somewhere before).
Thanks in advance of any help,
Trev.