Hello All :
Is there any idea to change the name of any control exist in a form , while the form is executed I must have a button when I pressed it a dialog appear this dialog must have(textbox) the new value of the selected control must written in this (textbox) .....
Thanks for support ...

Recommended Answers

All 10 Replies

Yes, you can!
OnSpecificEvent(....)
{
[Control].Name = "new name";
}

Sorry, I mean while the form is executed I want to change the control text , the button is responsible for changing the control text which it's have a dialog have a textbox it's change the control text ....
Thanks for support

confusing ......
may be u need to put above code in button click event
or if that control who's text u want is in another form then
form.control.text="text";

prbbly thats u want !!!!!!!

Control Text or control Name ????
if you've button you can change its text by
yourButton.Text = "lmlmalaa";
please clearify your question

Thanks a lot for your support , but if I create another form , the new value of the textbox I want to see it in this new form .... Any idea please

So your new question is how to pass a value (text) of the textbox in a form to another form (which has the control you want to change its text??!!)

Yes ,

declare this variable in form1
public static string pass;

assign the value : pass = Textbox1.Text;

Read From Form2
controlName = Form1.pass

u can also refer form1.control.property=value;

Thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.