Jump to content
Sign in to follow this  
plam4o

How to multiply two inputbox and show result in third

Recommended Posts

plam4o

How to multiply two inputbox and show result in third?

I want to put number in inputGo and inputP and when i pres the button result shows in inputG. Thank you.

#include
#include
Global $v
$Form2 = GUICreate("SSS", 290, 220, 312, 159)

$InputGo = GUICtrlCreateInput("", 8, 20, 65, 21)

$Label1 = GUICtrlCreateLabel("Go", 128, 24, 26, 17)

$InputP = GUICtrlCreateInput("", 105, 167, 73, 21)
$Label4 = GUICtrlCreateLabel("P", 117, 150, 54, 17)

$InputG = GUICtrlCreateInput("", 216, 20, 65, 21)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$ButtonCalc = GUICtrlCreateButton("Calculate", 104, 190, 75, 25)
GUICtrlSetOnEvent($ButtonCalc, "_Calculate")

GUISetState(@SW_SHOW)

Func _Calculate()
$InputG = Execute($InputGo*$InputP)
EndFunc

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonCalc
$v = Execute($InputGo*$InputP)

EndSwitch
WEnd

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, plam4o, welcome to the forum. Have a look at GuiCtrlRead, and GuiCtrlSetData in the help file. You would basically do something like this (play around with it to get the result you're looking for): GUICtrlSetData = GuiCtrlRead("field 1") x GuiCtrlRead("field 2").

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
plam4o

Thank you. Finally get it. You have a beer from me. :)

Edited by plam4o

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×