|
-
May 15th, 2021, 02:00 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Error on creating user control object
Hi all,
This error occurs whenever I place my user control on vb.net form.

How can I rectify it?
-
May 15th, 2021, 02:33 AM
#2
Re: Error on creating user control object
The error message tells you exactly what the problem is. You can't convert "NaN%" to a double because it is Not A Number. You need to show us your code if you want us to help you work out why your string is "NaN%" when you expected it to be something like "123456".
EDIT: It might just be a case of using TryParse and assigning 0 to your double if it fails.
Last edited by paulg4ije; May 15th, 2021 at 03:49 AM.
-
May 15th, 2021, 08:17 AM
#3
Re: Error on creating user control object
 Originally Posted by pourkascheff
How can I rectify it?
You're obviously doing some bad maths to get that text in the first place. I suspect that you are doing a percentage calculation somewhere and converting the result to a String but the result is Double.NaN. You're probably dividing by zero but a proper debug will tell you for sure.
You shouldn't need us to tell you to do a proper debug in the first place. The exception info you posted tells you exactly what the issue is and where it occurred. Did you even read it before posting? You should have immediately placed a breakpoint on that line 127 and seen for yourself what the issue was. You could have then worked backwards to see where the bad data was coming from and what you could do to prevent. That's all stuff you should be doing before posting here, then only posting if you can't work it out.
-
May 15th, 2021, 01:10 PM
#4
Thread Starter
Hyperactive Member
Re: Error on creating user control object
 Originally Posted by jmcilhinney
I suspect that you are doing a percentage calculation somewhere
You could be a super detective jmcilhinney =))) I'm serious.
 Originally Posted by paulg4ije
It might just be a case of using TryParse and assigning 0 to your double if it fails.
Exactly, But I'll tell you what I did.
Visual Studio has already ruined my projects close to the end, many times.
So, I used to back them up every few steps. I restored my RAR file and started to code again and tbh a better way was figured out and applied. No more errors has been took place @ the moment now.
-
May 15th, 2021, 08:52 PM
#5
Re: Error on creating user control object
 Originally Posted by pourkascheff
Visual Studio has already ruined my projects close to the end, many times.
You should be using source control to begin with. You can get a free Azure DevOps account and support is built right into VS. It also supports GitHub, any other Git provider and many other source control providers too. You can then revert to any previous state with a few clicks right in VS.
That said, if you keep having projects corrupted then either it's actually your fault or there's something wrong with your VS installation and you should be doing a repair or possibly even a full reinstall. I've never had such issues - the odd thing here and there but never anything consistent - and I've been using VS since 2003. It's not normal so don't just accept it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|