Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic .NET (http://www.programmingforums.org/forum19.html)
-   -   regarding the ubound function (http://www.programmingforums.org/showthread.php?t=4894)

Intimidat0r Jul 13th, 2005 5:24 PM

regarding the ubound function
 
Okay so Im trying to do this:

:

Public C As Integer
Public Functions As String

For C = 0 To Ubound(Functions)
    'Do code and stuff
Next


and it compiles nicely but when i run it it flags the line that calls Ubound() (the definition of the For loop or whatever it's called) and it says:

Quote:

System.ArgumentNullException
Value cannot be null
I kind of know what this means but I just started using VB.NET because Im used to C and PHP mostly (OSS LAMP stuff) so can somebody tell me how i can fix this problem? thanks.

DaWei Jul 13th, 2005 8:27 PM

I don't know .NET myself, but I would have to ask, "What are you expecting the value of "Functions" to be?". You haven't set it to anything that I can see.

Infinite Recursion Jul 14th, 2005 9:24 AM

The value for the "Functions" string cannot be NULL, blank, etc... this will more than likely break the Ubound function and cause the error that you listed. Try assigning a value to the "Functions" string and giving it another go.

Ooble Jul 15th, 2005 10:04 AM

Functions isn't an array - it doesn't have a UBound. Try For C = 0 To Functions.Length - 1 instead.

Rory Aug 1st, 2005 1:59 PM

Ah you're being far to complex and subtle for VB.

Pretend Strings don't exist, and declare it as an array of type Char or Byte.

Or better still use C.

DaWei Aug 1st, 2005 2:54 PM

I would guess he was looking for a solution to his problem, rather than a redirection in his career path or tools or a way to sneak past his problem voodoo-wise. It isn't invariably necessary to initialize things in every language extant, but it often is. VB is more strongly typed than, say, Javascript. I suspect that the solutions, proposed a couple weeks ago, fixed 'im up, one way or another.


All times are GMT -5. The time now is 4:26 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC