|
-
May 15th, 2013, 05:02 PM
#1
Thread Starter
New Member
(Value Null, Paramter Name: Source) error. HELP?!
I'm working on a project for my Visual Basic class, and I keep getting this error.(Value Null, Paramter Name: Source). It highlights the whole query so I can't figure out specifically where the problem is. I'll attach a screenshot of my code or something to show you. My teacher isn't able to help, probably because he doesn't know anything about Visual Basic so any help is appreciated.
Print Screen of the Code: http://prntscr.com/15320w
-
May 15th, 2013, 05:24 PM
#2
Re: (Value Null, Paramter Name: Source) error. HELP?!
Please don't use screen capture for code. It's more difficult to read and impossible to copy!
In a nutshell, I simply don't understand this query. What are the total and average doing in there? What's the FormatNumber doing?
In the meantime, where do you declare the length of golfers()? Why are you doing a Redim on scores which is a derived array and therefore self-defined but not on golfers() and why aren't you getting an error long before this.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 15th, 2013, 06:09 PM
#3
Thread Starter
New Member
Re: (Value Null, Paramter Name: Source) error. HELP?!
The total is to total the scores...average is to average each person's scores (these are two requirements of the project)
Sorry for screen capture...I just made an account for the sole use of trying to figure out this specific error, as it is my first post.
As for the redim, You did catch me there..that was a mistake...
Im a little unsure where I should be declaring the length of golfers()? I'm trying to look of some other examples I've managed to find and I can't see an example of where I should. As for the the last statement...I really don't know
Last edited by edoczkat; May 15th, 2013 at 06:17 PM.
-
May 15th, 2013, 07:43 PM
#4
Re: (Value Null, Paramter Name: Source) error. HELP?!
There's something going on there that you're not aware of. The code in your Load event handler doesn't work. It is throwing an exception but, as a result of a quirk in 64-bit Windows, that exception is just being swallowed. The reason the exception that you do see is thrown is that you never actually assign an object to 'golfers'. You're being told that the source of data for your query cannot be a null reference. That will go away if you fix the issues in your Load event handler.
If you do as dunfiddlin says then all should be well. You are reading the data into 'scores' but then you go and blow all that data away with your ReDim statement. What is that ReDim supposed to be doing? Have you thought about it? You already have the list of data from the file in 'scores' and you intend to transfer the data from 'scores' to 'golfers'. As such, you need to make the 'golfers' array the same size as the 'scores' array. ReDim resizes an array and it's 'golfers' that needs to be resized, not 'scores'.
-
May 15th, 2013, 07:45 PM
#5
Re: (Value Null, Paramter Name: Source) error. HELP?!
 Originally Posted by dunfiddlin
why aren't you getting an error long before this. 
I can't recall all the specifics but, due to some internal politics at Microsoft, exceptions inside the Load event handler of the startup form are swallowed on 64-bit Windows. You'd see notification in the Output window while debugging but nothing more. Any code after the exception is simply not executed and the form is displayed.
-
May 15th, 2013, 07:51 PM
#6
Re: (Value Null, Paramter Name: Source) error. HELP?!
My inclination to 'upgrade' to a 64 bit machine declines steadily!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 15th, 2013, 08:21 PM
#7
Thread Starter
New Member
Re: (Value Null, Paramter Name: Source) error. HELP?!
I realized what he was saying, and changed that part so its ReDim's golfers. Im still getting the same error though. What your saying is in reality, there isn't a problem with the query(at least not this specific problem) but it is in the Load? What is the problem with the Load then? I've been looking at it for a while and can't seem to find the exact line it's in. (by the way in case it wasn't obvious, i'm not expert at this...that's why i'm asking for the help...)
-
May 15th, 2013, 08:30 PM
#8
Re: (Value Null, Paramter Name: Source) error. HELP?!
As I've said, unhandled exceptions thrown in the Load event handler of the startup form (maybe other forms too, can't recall) on 64-bit machines are swallowed. The first step, then, is to make sure that there are no unhandled exceptions thrown in the Load event handler. The way to do that is to wrap the entire contents of the Load event handler in an exception handler, i.e.
Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
'your code here
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
Then you'll know if an exception is thrown and what it is.
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
|