Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

NumericUpDown in DataGridView in VS.Net 2005 BETA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kapilp - 07 Dec 2004 20:21 GMT
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.
Ed Kaim - 13 Dec 2004 15:23 GMT
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.

>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
[quoted text clipped - 52 lines]
>
> Any help would be appreciated.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.