Welk bestands type voor tijd.

Status
Niet open voor verdere reacties.

steven1989

Nieuwe gebruiker
Lid geworden
26 nov 2007
Berichten
4
Hallo ik ben net begonnen met programmeren en ik wou een stopwatch maken om er wat handiger in te worden maar nu heb ik toch nog een probleem.

Welk bestandstype moet ik gebruiken om een tijd op te slaan in een variable? en zo dat ik er secondes aan die tijd kan toevoegen in mijn script. ik heb integer geprobeerd maar dat werkt niet. hier vind je het script dat ik gebruikte om steeds bij elke tik een seconde bij de tijd op te tellen.
Code:
int tijd;
            tijd = int.Parse(Stopwatch.Text);
            tijd++;
            Stopwatch.Text = tijd.ToString();

en hier vind je de fout melding die ik kreeg

System.FormatException was unhandled
Message="De indeling van de invoertekenreeks is onjuist."
Source="mscorlib"
StackTrace:
bij System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
bij System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
bij System.Int32.Parse(String s)
bij Stopwatch.Form1.timer1_Tick(Object sender, EventArgs e) in C:\Users\Halert\Documents\Visual Studio 2008\Projects\Stopwatch\Stopwatch\Form1.cs:regel 56
bij System.Windows.Forms.Timer.OnTick(EventArgs e)
bij System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
bij System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bij System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bij System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bij System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bij System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bij System.Windows.Forms.Application.Run(Form mainForm)
bij Stopwatch.Program.Main() in C:\Users\Halert\Documents\Visual Studio 2008\Projects\Stopwatch\Stopwatch\Program.cs:regel 18
bij System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bij System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bij Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bij System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bij System.Threading.ThreadHelper.ThreadStart()
InnerException:
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan