|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
NumericUpDown in DataGridView in VS.Net 2005 BETAms-help://MS.VSCC.v80/MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxmclictl/html/e79a9d4e-64ec-41f5-93ec-f5492633cbb2.htm to create a custom numeric updown control to host it in a datagridview. The code for the control is attached in the .cs file. It is working, mostly… when I change the value of the cell using the numeric keypad and change rows I don’t have a problem but when I change the value of the cell using the numeric up down control then I get the following error. “Specified cast is not valid.†This is the stacktrace. " at System.Windows.Forms.DataGridView.EditingControls_Click(Object sender, EventArgs e)\r\n at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n at System.Windows.Forms.UpDownButtons.OnMouseUp(MouseEventArgs e)\r\n at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)\r\n at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.Run(Form mainForm)\r\n at IMax.Max.MaxApplication.Program.Main() in C:\\Work\\Max\\Max\\Program.cs:line 42\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at VSHostUtil.HostProc.RunUsersAssembly()\r\n at System.Threading._Thread.ThreadStart_Context(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callBack, Object state, StackCrawlMark& stackMark)\r\n at System.Threading._Thread.ThreadStart()" Target Site: {Void EditingControls_Click(System.Object, System.EventArgs)} I am not sure why the error is happening. I stepped through the code and can’t really come to a conclusion. Any help would be appreciated. Although I don't have much context, I've noticed that I end up getting a lot
of headaches from the fact that NumericUpDowns use decimal types, which I often forget when moving numbers around. It may or may not have to do with the cast error. Show quoteHide quote "kapilp" <kap***@discussions.microsoft.com> wrote in message news:22D08D87-6271-4E6E-8756-3D8E6B33DF40@microsoft.com... >I used the article located at > ms-help://MS.VSCC.v80/MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxmclictl/html/e79a9d4e-64ec-41f5-93ec-f5492633cbb2.htm > to create a custom numeric updown control to host it in a datagridview. > The > code for the control is attached in the .cs file. > > It is working, mostly. when I change the value of the cell using the > numeric > keypad and change rows I don't have a problem but when I change the value > of > the cell using the numeric up down control then I get the following error. > > "Specified cast is not valid." > > This is the stacktrace. > " at System.Windows.Forms.DataGridView.EditingControls_Click(Object > sender, EventArgs e)\r\n at > System.Windows.Forms.Control.OnClick(EventArgs > e)\r\n at System.Windows.Forms.UpDownButtons.OnMouseUp(MouseEventArgs > e)\r\n at System.Windows.Forms.Control.WmMouseUp(Message& m, > MouseButtons > button, Int32 clicks)\r\n at > System.Windows.Forms.Control.WndProc(Message& > m)\r\n at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& > m)\r\n at System.Windows.Forms.ControlNativeWindow.WndProc(Message& > m)\r\n > at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 > msg, IntPtr wparam, IntPtr lparam)\r\n at > System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n > at > System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 > dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at > System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, > ApplicationContext context)\r\n at > System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, > ApplicationContext context)\r\n at > System.Windows.Forms.Application.Run(Form mainForm)\r\n at > IMax.Max.MaxApplication.Program.Main() in > C:\\Work\\Max\\Max\\Program.cs:line > 42\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] > args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, > Evidence > assemblySecurity, String[] args)\r\n at > VSHostUtil.HostProc.RunUsersAssembly()\r\n at > System.Threading._Thread.ThreadStart_Context(Object state)\r\n at > System.Threading.ExecutionContext.Run(ExecutionContext executionContext, > ContextCallback callBack, Object state, StackCrawlMark& stackMark)\r\n > at > System.Threading._Thread.ThreadStart()" > > Target Site: {Void EditingControls_Click(System.Object, System.EventArgs)} > > I am not sure why the error is happening. I stepped through the code and > can't really come to a conclusion. > > Any help would be appreciated. >
Other interesting topics
DataBinding, grr
Drag form w/out controlbox Is C# is having a seperate class library? Loop through datagrid to get values of boolean columns how to loop through a winforms datagrid to get all selected(checke Making a UserControl scroll when host form is resized Delegating Menu Commands Calculations with DateTime fields using DataColumn.Expression stri I need to run a vb.net or aspx.net file every 10 seconds. Tabbing to next field after Return key |
|||||||||||||||||||||||