![]() |
Visual Basic
Just wondering has anyone ever used visual basic, if so just wondering if you know how to add up the values in two text boxes and then subtract it from a value from a label thanks.
|
Label2.Caption = Textbox1.Text + Textbox2.Text - Label1.caption ?? not used it for ages!
|
Probably best in IT section mate.
Funny you should ask though, I was using it all day yesterday at work programming....have you used Macros before? |
I am doing a course on it.. but I can't rememebr xD
Is it VB.Net or VB6? |
[QUOTE=saxotistic;1645986]Just wondering has anyone ever used visual basic, if so just wondering if you know how to add up the values in two text boxes and then subtract it from a value from a label thanks.[/QUOT
Nope did java scripting in college which is ment to be very similar if i remember correctly |
from the javascripts ive seen, its completely diff lol
|
Hey i used VB6 alot back in college, should of really posted this in the IT section but nvm eh.
You will need a few variables.. Dim labelnumber As Currency Dim textonenumber As Currency Dim texttwonumber As Currency Dim answer As Currency Private Sub Command1_Click() Let textonenumber = Text1.Text Let texttwonumber = Text2.Text Let labelnumber = Label1 Let answer = textonenumber + texttwonumber - labelnumber Let Text3.Text = answer End Sub There you go mate, you'll need three textboxs, one label, and a command button. ![]() |
Quote:
|
Quote:
|
I havn't used VB in ages, but dont you have to type convert between strings and integers using val()?
|
oops you mean subtract the values out the textboxes from the label, iv done the label from the textboxs. one minute.
edit, Well its alot easier using a button, but.. one minute i'll have a quick look. |
Set an event for the textbox (OnChange or OnKeyPress).
|
Quote:
|
Done a quick 5 minute job here, dont know if it will help.
Dim labelnumber As Currency Dim textonenumber As Currency Dim texttwonumber As Currency Dim answer As Currency Private Sub Text1_Change() Let textonenumber = Text1.Text Let texttwonumber = Text2.Text Let labelnumber = Label1 Let answer = labelnumber - (textonenumber + texttwonumber) Let Text3.Text = answer End Sub Private Sub Text2_Change() Let textonenumber = Text1.Text Let texttwonumber = Text2.Text Let labelnumber = Label1 Let answer = labelnumber - (textonenumber + texttwonumber) Let Text3.Text = answer End Sub Private Sub Text3_Change() Let textonenumber = Text1.Text Let texttwonumber = Text2.Text Let labelnumber = Label1 Let answer = labelnumber - (textonenumber + texttwonumber) Let Text3.Text = answer End Sub ![]() Put the data format for the textboxs to number also. (properties) edit: in the screenshot i've forgot to delete the command button. |
Quote:
edit get a screenshot of your work up so i can see what you mean ? |
I'll post some Visual Basic program soon, ever tried Dev C++ much easier program to use in my opion.
|
Delphi or C# is a good start for beginners, Microsoft do a free version of C#.NET
http://www.microsoft.com/express/vcsharp/ |
delphi and c++ are good, but i made my first prog in vB years ago lol.
tbh delphi and vb are pointless knowing in the working world as its old skool now, gd to learn from tho.. |
I had to use this in computing at college. Got bored so spent the whole year making awesome pointless crap and sending it around. Like a thingy that opens and closes the disk try every three seconds you cant turn off. Good times
|
Quote:
|
All times are GMT. The time now is 06:23. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.