Click here to Skip to main content
15,908,618 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I used the following code in my application for making accelerated keys. It will work but the problem is when the page load the button shows the name "button1" instead of the text ("log in"). I assigned it in property. Please ignore my mistake.
string buttonName = "button1";
string buttonShortcut = "B";
buttonName = Regex.Replace(buttonName, buttonShortcut, "&" + buttonShortcut, RegexOptions.IgnoreCase);
button1.Text = buttonName;
Posted
Updated 23-Nov-10 18:40pm
v3
Comments
JF2015 24-Nov-10 0:40am    
Edited for spelling and code formatting.

1 solution

Why does your button need to change name at runtime?

Why are you using Regex instead of a stringbuilder?

Why not do this in the form load event?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900