Jump to content

How to multiply two inputbox and show result in third


plam4o
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...