3 Replies - 3894 Views - Last Post: 10 March 2010 - 01:13 PM Rate Topic: -----

#1 slide23   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-March 10

Custom Control Text Property Not Saving

Posted 10 March 2010 - 02:01 AM

I'm creating my own Win Forms custom control but I can not get a "Text" property to work and save. When i set it in the Designer Property list it SHOULD add the following code but it just wont do it and when i shut down VS and then start it again with this project, the value i did enter is now gone.

this.userControl1.Text = "My Text";


I created a new control and all I added to it is the following code

[Browsable(true)]
public override string Text
{
	get
	{
		return base.Text;
	}
	set
	{
		base.Text = value;
	}
}


If I remove override and change "Text" to something like "MyText" then the .MyText property gets properly saved int eh MyForm.Designer.cs like it should. I've posted a copy of a solution with the new control and form to illustrate. http://rapidshare.co...ation1.zip.html

Is This A Good Question/Topic? 0
  • +

Replies To: Custom Control Text Property Not Saving

#2 FlashM   User is offline

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Custom Control Text Property Not Saving

Posted 10 March 2010 - 02:25 AM

I believe you are doing something wrong... Could you post some more of your code to see how you created your custom user control. What base class did you use? It's hard to say what is wrong by giving us just few lines of code...
Was This Post Helpful? 0
  • +
  • -

#3 slide23   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-March 10

Re: Custom Control Text Property Not Saving

Posted 10 March 2010 - 01:10 PM

I posted a link to the full solution at the end, but I'll upload it again here too.

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#4 FlashM   User is offline

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Custom Control Text Property Not Saving

Posted 10 March 2010 - 01:13 PM

Could you embed your code inside the thread... Use code tags to do that...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1