Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I put default images and captions in my class?
Message
From
12/08/2004 10:25:17
 
 
To
12/08/2004 00:47:13
Czarina Joyce Villanueva
Innovision Systems International
Manila, Philippines
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00931505
Message ID:
00932711
Views:
20
Hmmmm ... you're right, the Text on the button changes when you drop it in the IDE. I had an existing sub-classed button on a Form and I simply went to the button class and changed the Text and added an image. When I went back to look at my form the button had the new text and image, so at that point I hadn't tested actually dropping it on my form since it was already there. But, now that I've tested it I see the problem. And here's the solution:

Instead of putting the this.Text = "MyButton" in the constructor, create an EventHandler for the HandleCreated event (since a button doesn't have a load) and put it there instead.
	private void BBButton_HandleCreated(object sender, EventArgs e)
	{
		this.Text = "MyButton";
	}
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform