San24
asked on
Serialization Deserialization Control property
Serialization / DeSerialization Question
Experts,
Why can`t I serialize, Something like this? What's the work around?
public string TBoxStr
{
get
{
return textbox1.text;
}
set
{
textbox1.text = value;
}
}
I tried something like this too, and it doesn`t work.
private string tboxstr;
public string TBoxStr
{
get
{
tboxstr = textbox1.text;
return tboxstr;
}
set
{
tboxstr = value
textbox1.text = tboxstr;
}
}
I have no problem Serializing and Deserializing something like this -
private string property;
public string Property
{
get
{
return property;
}
set
{
property = value
}
}
I was hoping I could Serialize TBoxStr. What am I missing here?
Experts,
Why can`t I serialize, Something like this? What's the work around?
public string TBoxStr
{
get
{
return textbox1.text;
}
set
{
textbox1.text = value;
}
}
I tried something like this too, and it doesn`t work.
private string tboxstr;
public string TBoxStr
{
get
{
tboxstr = textbox1.text;
return tboxstr;
}
set
{
tboxstr = value
textbox1.text = tboxstr;
}
}
I have no problem Serializing and Deserializing something like this -
private string property;
public string Property
{
get
{
return property;
}
set
{
property = value
}
}
I was hoping I could Serialize TBoxStr. What am I missing here?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For some reason I cant seem to upload the compressed project here. I`m getting a SUO file not allowed message. Anyways, here is the main form and the User Cntrl. I`m trying to Serialize and DeSerialize the textbox field in the User Control UC. I can Serialize without any problems, I can look at the value in the file but I run into problems DeSerializing it.
Any help to get me out of this would be greatly appreciated!
Form1.cs
UC.cs
Any help to get me out of this would be greatly appreciated!
Form1.cs
UC.cs
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Novice_Novie - The problem is not Serializing, the problem I`m having is the property getting the Text Box value. One way to do is using the Validating or the Leave events and then initializing the property. Not the most efficient way to do it since I have multiple controls on the User Control.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@vusov : You Sir are the man! I didn`t miss the InitializeComponent(), I just didn`t know that was to be used. Didn`t find it any of the examples out there. Let me try this on the main program and then assign the points. Thanks again!
WindowsFormsApplication2.zip