C# Parsing
What Is It:
In C# "Parsing" is basically analyzing something and attempting to convert it.
Getting Started:
Start by creating a new textBox and Button. What we want to accomplish here is popping up a MessageBox that shows the value of your integer. However, we cannot just show the integer value, we must parse it!
First, create a new integer and set it equal to your textbox's text.
Code
int test = textBox1.Text;Now, this will not work! This is because we are attempting to set a number variable equal to text. So, in order for this to work, we need to parse it.
Code
int test = int.Parse(textBox1.Text);int.Parse(textBox1.Text)
All this does is parse the text inside of the textbox into an integer value, pretty easy, huh!
Showing The Number
Code
MessageBox.Show(test.ToString());Spoiler (Click to View)
Code:
Code
private void button1_Click(object sender, EventArgs e)
{
int test = int.Parse(textBox1.Text);
MessageBox.Show(test.ToString());
}http://www.pulsecodes.info
Computer and Information Science major.
Information Technology Apprentice.
Freelance Programmer.
Computer and Information Science major.
Information Technology Apprentice.
Freelance Programmer.


