Feeds:
Posts
Comments

Archive for the ‘C#’ Category

I have a windows form for data entry and the error checking is performed using ErrorProvider control available.
 
Development tool: Visual Studio 2005
 
Say, user forgot to fill in the name then click an Insert button. The red exclamation mark will pop out that says "Name is missing". The user then fill in the name then click the Insert button again. The Insert action failed with the following error. The bit of the code that failed is the TrainingRegDetailsTableAdapter.Insert method bit. I checked the code again and again and it seems fine but it kept failing on every run. I googled and some users said it is a bug. So luckily I have kept a previous version of the code and copied and pasted the TrainingRegDetailsTableAdapter.Insert method bit to the current code. To my amazement, it resolved the error!.
 
Apparently this is not a bug.. it is my bloody laptop … it happened again today… and  it worked fine after a restart …. ….. ….. sigh…
 
System.FormatException was unhandled
  Message="Input string was not in a correct format."
  Source="mscorlib"
  StackTrace:
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
       at System.Single.Parse(String s, NumberStyles style, NumberFormatInfo info)
       at System.Single.Parse(String s)
       at GemcomTrainingSystem.DataEntryForm.InsertButton_Click(Object sender, EventArgs e) in C:\Gemcom Training System\GemcomTrainingSystem\DataEntryForm.cs:line 60
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at GemcomTrainingSystem.Program.Main() in C:\Gemcom Training System\GemcomTrainingSystem\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
 

Read Full Post »