derkaderka 0 Posted November 30, 2010 I made an application in AutoIT that calculates change in time. Here is the code: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region $Form1 = GUICreate("Change In Time", 401, 123, 192, 124) $Input1 = GUICtrlCreateInput("", 16, 16, 41, 21) $Input2 = GUICtrlCreateInput("", 16, 48, 41, 21) $Input3 = GUICtrlCreateInput("", 144, 16, 41, 21) $Input4 = GUICtrlCreateInput("", 144, 48, 41, 21) $Label1 = GUICtrlCreateLabel("Hours", 64, 18, 40, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Minutes", 64, 50, 58, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("Hours", 192, 18, 40, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("Minutes", 192, 50, 58, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Calculate", 168, 88, 75, 25) $Group1 = GUICtrlCreateGroup("Start", 8, 0, 121, 81) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("End", 136, 0, 121, 81) GUICtrlCreateGroup("", -99, -99, 1, 1) $Input5 = GUICtrlCreateInput("", 280, 16, 41, 21) $Input6 = GUICtrlCreateInput("", 280, 48, 41, 21) $Label5 = GUICtrlCreateLabel("Hours", 328, 18, 40, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label6 = GUICtrlCreateLabel("Minutes", 328, 50, 58, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Group3 = GUICtrlCreateGroup("Output", 272, 0, 121, 81) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $hourread2 = GUICtrlRead($Input3) $hourread1 = GUICtrlRead($Input1) $minutesread2 = GUICtrlRead($Input4) $minutesread1 = GUICtrlRead($Input2) $finalhours = $hourread2 - $hourread1 If $minutesread1>$minutesread2 Then $finalhours -=1 $minutesread2 +=60 EndIf $minutesfinal = $minutesread2 - $minutesread1 GUICtrlSetData($Input5, $finalhours) GUICtrlSetData($Input6, $minutesfinal) EndSwitch WEnd I am trying to do the same thing in C Sharp, can anybody help me with this? Share this post Link to post Share on other sites
Fubarable 1 Posted November 30, 2010 The process to do this in C# is completely different than in AutoIt, for one you'd be using a time-specific class, possibly the DateTime class, getting time info by calling the static now method,... but why ask here? why not on a C# forum? Share this post Link to post Share on other sites
derkaderka 0 Posted December 1, 2010 I don't know any c# forums. Are there any good ones? Share this post Link to post Share on other sites
JohnOne 1,603 Posted December 1, 2010 Try getting your post moved to the chat forum, but it just looks like simple addition and subtraction to me, whats your problem with conversion? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
derkaderka 0 Posted December 2, 2010 Well I want to be able to display hours and minutes, if I convert to minutes, I would have to find some way of converting back to hours and minutes. Normally you would do this by dividing and finding the remainder. However I am not aware of any script/program that can do that, and if they can, how? Share this post Link to post Share on other sites
Steveiwonder 0 Posted December 2, 2010 (edited) ignore Edited December 2, 2010 by Steveiwonder They call me MrRegExpMan Share this post Link to post Share on other sites