how to make a single textbox to input 2 numbers and the 1st number must be stored into memory(calcul

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="color:black; font-family:"Verdana","sans-serif"; font-size:9pt so i am new to visual basic and i decided to create a calculator so i made one with 2 textboxes and label those text boxes are to put them the 1st and the 2nd number then press
the mathematical symbol like + - * / etc to get the result on the label like this

<span style="color:black; font-family:"Verdana","sans-serif"; font-size:9pt now i want to make only 1 text box from which i can put the 1st number then press any mathematical symbol then input second number then press equal sign(which i will make) apperantly
thats easy but the tricky part which idk is i need to store the 1st number before i input the 2nd number and i need your help in that as i googled this i stumbled across variables and Arrays but i really dont understand this so i appreciate if any one would
help me i couldnt understand them as we didnt study this part at school(i am in 9th grade)
<span style="color:black; font-family:"Verdana","sans-serif"; font-size:9pt ------2nd Question When Putting the codes to do the percentage function i had to put those lines
<span style="color:blue; font-family:Consolas; font-size:10pt Private
<span style="color:blue; font-family:Consolas; font-size:10pt Sub<span style="color:black; font-family:Consolas; font-size:10pt Button7_Click(<span style="color:blue; font-family:Consolas; font-size:10pt ByVal<span style="color:black; font-family:Consolas; font-size:10pt
sender <span style="color:blue; font-family:Consolas; font-size:10pt As<span style="color:black; font-family:Consolas; font-size:10pt System.<span style="color:#2b91af; font-family:Consolas; font-size:10pt Object<span style="color:black; font-family:Consolas; font-size:10pt ,
<span style="color:blue; font-family:Consolas; font-size:10pt ByVal<span style="color:black; font-family:Consolas; font-size:10pt e
<span style="color:blue; font-family:Consolas; font-size:10pt As<span style="color:black; font-family:Consolas; font-size:10pt System.<span style="color:#2b91af; font-family:Consolas; font-size:10pt EventArgs<span style="color:black; font-family:Consolas; font-size:10pt )
<span style="color:blue; font-family:Consolas; font-size:10pt Handles<span style="color:black; font-family:Consolas; font-size:10pt Button7.Click
<span style="color:black; font-family:Consolas; font-size:10pt Label1.Text = Val(TextBox1.Text) / 100
<span style="color:black; font-family:Consolas; font-size:10pt Label1Text = Val(TextBox2.Text)/100
<span style="color:black; font-family:Consolas; font-size:10pt but then i find it gives me zero if i type in the first textbox while it gives me the correct percentage if i type it in the 2nd textbox which led me to delete the line of the 2nd textbox to
make the 1st one work properly without always giving me zero? any ideas how to make them both work right?
<br/>

View the full article
 
Back
Top