I just started learning visual basic about 1 week and a half ago, and I'm just wondering if there is a way to compare text box values. e.g. text1.text = 5 and text2.text = 10, rather then subtracting it, I was hoping if there was a way to find the difference of the text box values.

I'm trying to make my first program that allows the user to enter a value in the text box. and another value in another text box, and make a label display the difference.

Lol, Since you people know more then I, could you try to make it simple cause it makes things easier for me.


you need to do it like this:

label1.text = val(textbox1.text) - val(textbox2.text)

Or the Net way:

Label1.Text = (Single.Parse(TextBox1.Text) - Single.Parse(TextBox2.Text)).ToString

Until they get rid of Val, I am sticking with that :-)

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.