Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
So suppose a person enters apple in the textbox i want to make it so a variable
string apple = apple is created

or if a person enters a user name and password in different textboxes on a registeration screen the code

if(textbox.Text = "Username" && textbox2.text == "Password")
{

}

is automatically created

What I have tried:

string textbox1.text = textBox1.Text;
Posted
Updated 23-Aug-18 4:21am
Comments
Leo Chapiro 23-Aug-18 10:40am    
Your goal is not really clear: what do you want to achieve by that?

1 solution

You don't. In simple terms, variable names only exist until compile-time.

If you want a "variable" to hold a value, you would normally keep such things in a Dictionary collection. It's not a true variable in the sense you're talking about, but the name entered becomes a "key" in the collection, pointing to the associated value, known as a key/value pair.
 
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