Saxperience - Citroen Saxo Forum

Saxperience - Citroen Saxo Forum (http://www.saxperience.com/forum/index.php)
-   Gaming, IT, Multimedia & Music (http://www.saxperience.com/forum/forumdisplay.php?f=66)
-   -   Visual Basic (http://www.saxperience.com/forum/showthread.php?t=113852)

saxotistic 24th November 2007 15:30

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.

b0t13 24th November 2007 15:31

Label2.Caption = Textbox1.Text + Textbox2.Text - Label1.caption ?? not used it for ages!

Luke 24th November 2007 15:32

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?

MrHouston 24th November 2007 15:32

I am doing a course on it.. but I can't rememebr xD

Is it VB.Net or VB6?

VTR_Nick 24th November 2007 15:32

[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

b0t13 24th November 2007 15:34

from the javascripts ive seen, its completely diff lol

Paul 24th November 2007 15:40

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.


saxotistic 24th November 2007 15:40

Quote:

Originally Posted by b0t13 (Post 1645990)
Label2.Caption = Textbox1.Text + Textbox2.Text - Label1.caption ?? not used it for ages!

gonna try that out now thanks:y:

saxotistic 24th November 2007 15:46

Quote:

Originally Posted by Paul_CGM (Post 1646012)
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.


would it be possible to do it without using a command button, i am doing a marketing section for my assignemnt, so in marketing there are different promotion method so i want the user to enter the amount in % they wish to spend of their promotion budget, then i want something like a label displaying 100% so as the user eneters the % they wish to spend for it decrease it automatically if that makes sense, thanks

Alex 24th November 2007 15:47

I havn't used VB in ages, but dont you have to type convert between strings and integers using val()?

Paul 24th November 2007 15:47

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.

Alex 24th November 2007 15:49

Set an event for the textbox (OnChange or OnKeyPress).

saxotistic 24th November 2007 15:52

Quote:

Originally Posted by Paul_CGM (Post 1646027)
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.

Yeh sorry, so for example if they want to spend 50% on t.v advertising, then it should deducted it from the label but also if the user decides they want to make the 50% to 40% so the label goes back up by 10% becuase of the change so i want the label value to go up and down based on the numbers the user enters, thanks

Paul 24th November 2007 15:52

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.

Paul 24th November 2007 15:56

Quote:

Originally Posted by saxotistic (Post 1646034)
Yeh sorry, so for example if they want to spend 50% on t.v advertising, then it should deducted it from the label but also if the user decides they want to make the 50% to 40% so the label goes back up by 10% becuase of the change so i want the label value to go up and down based on the numbers the user enters, thanks

Hmm complicated it now, you want to change the value of the label?

edit
get a screenshot of your work up so i can see what you mean ?

Scattle 24th November 2007 17:19

I'll post some Visual Basic program soon, ever tried Dev C++ much easier program to use in my opion.

Alex 24th November 2007 22:55

Delphi or C# is a good start for beginners, Microsoft do a free version of C#.NET

http://www.microsoft.com/express/vcsharp/

b0t13 24th November 2007 23:41

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..

TU-Tuning 25th November 2007 00:07

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

Paul 25th November 2007 03:03

Quote:

Originally Posted by Ben_Saxo (Post 1647406)
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

*cough* cntrl alt delete *cough*


All times are GMT. The time now is 06:23.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.