473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Code check please...

Thanks in advance:

Dim thisperson(7) As Array
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
....

private function getperson(byval username as string, byval pinnumber as
string)
....
dim returnarray(7)
....

return returnarray

Error: Invalid cast exception is being thrown on thisperson = ... after it
executes the function...what am I missing here????

Thanks!
Derek
Nov 20 '05 #1
15 1065
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message news:uv**************@TK2MSFTNGP09.phx.gbl...
Thanks in advance:

Dim thisperson(7) As Array
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
...

private function getperson(byval username as string, byval pinnumber as
string)
...
dim returnarray(7)
Should this not be Dim returnarray(7) As Array?
...

return returnarray

Error: Invalid cast exception is being thrown on thisperson = ... after it
executes the function...what am I missing here????

Thanks!
Derek

Nov 20 '05 #2
Well, I was following what you said and actually removed the as array from
thisperson to yield:

Dim thisperson(7)
and then
Dim returnarray(7)

same error....
????
Derek

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message

news:uv**************@TK2MSFTNGP09.phx.gbl...
Thanks in advance:

Dim thisperson(7) As Array
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
...

private function getperson(byval username as string, byval pinnumber as
string)
...
dim returnarray(7)


Should this not be Dim returnarray(7) As Array?
...

return returnarray

Error: Invalid cast exception is being thrown on thisperson = ... after it executes the function...what am I missing here????

Thanks!
Derek


Nov 20 '05 #3
I'm not sure if this is the problem, but you should declare "returnarray" as
an "Array" object and specify the return type of the "getperson" function to
be "as Array()".

Are you actually trying to return an array of arrays?
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Thanks in advance:

Dim thisperson(7) As Array
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
...

private function getperson(byval username as string, byval pinnumber as
string)
...
dim returnarray(7)
...

return returnarray

Error: Invalid cast exception is being thrown on thisperson = ... after it executes the function...what am I missing here????

Thanks!
Derek

Nov 20 '05 #4
That was what I tried in my first attempt and it gave me the cast error. I
am returning an array of strings: returnarray(0) = bob,
returnarray(1)=hello, etc.

???
:-)

Derek
"Scott" <sc*****@yahoo.com> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
I'm not sure if this is the problem, but you should declare "returnarray" as an "Array" object and specify the return type of the "getperson" function to be "as Array()".

Are you actually trying to return an array of arrays?
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Thanks in advance:

Dim thisperson(7) As Array
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
...

private function getperson(byval username as string, byval pinnumber as
string)
...
dim returnarray(7)
...

return returnarray

Error: Invalid cast exception is being thrown on thisperson = ...
after it
executes the function...what am I missing here????

Thanks!
Derek


Nov 20 '05 #5
Cor
Hi Derek,

Make it you more covertable even with the approach which is not ideal for
this.

Dim thisperson(7) As String
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
....

private function getperson(byval username as string, byval pinnumber as
string) as String()
....
dim returnarray(7) as String()

return returnarray

I think this should do it.

Cor

Nov 20 '05 #6
That was what I tried in my first attempt and it gave me the cast error. I
am returning an array of strings: returnarray(0) = bob,
returnarray(1)=hello, etc.

???
:-)

Derek
"Scott" <sc*****@yahoo.com> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
I'm not sure if this is the problem, but you should declare "returnarray" as an "Array" object and specify the return type of the "getperson" function to be "as Array()".

Are you actually trying to return an array of arrays?
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Thanks in advance:

Dim thisperson(7) As Array
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
...

private function getperson(byval username as string, byval pinnumber as
string)
...
dim returnarray(7)
...

return returnarray

Error: Invalid cast exception is being thrown on thisperson = ...
after it
executes the function...what am I missing here????

Thanks!
Derek


Nov 20 '05 #7
Cor
Hi Derek,

Make it you more covertable even with the approach which is not ideal for
this.

Dim thisperson(7) As String
Dim validcheck As Boolean = False

thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text)
....

private function getperson(byval username as string, byval pinnumber as
string) as String()
....
dim returnarray(7) as String()

return returnarray

I think this should do it.

Cor

Nov 20 '05 #8
On Thu, 1 Apr 2004 20:59:13 +0200, Cor wrote:

Hi Cor
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

??

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #9
On Thu, 1 Apr 2004 20:59:13 +0200, Cor wrote:

Hi Cor
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

??

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #10
It should be the same type of declaration as the original array. That's the
only way to return it from the function without the "Invalid cast"
exception. I'm guessing this was a type-o...

dim returnarray(7) as String
"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news:18*****************************@40tude.net...
On Thu, 1 Apr 2004 20:59:13 +0200, Cor wrote:

Hi Cor
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

??

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.

Nov 20 '05 #11
It should be the same type of declaration as the original array. That's the
only way to return it from the function without the "Invalid cast"
exception. I'm guessing this was a type-o...

dim returnarray(7) as String
"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news:18*****************************@40tude.net...
On Thu, 1 Apr 2004 20:59:13 +0200, Cor wrote:

Hi Cor
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

??

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.

Nov 20 '05 #12
That did it - typos suck! Thank you all!

Derek

"Scott" <sc*****@yahoo.com> wrote in message
news:uX**************@TK2MSFTNGP11.phx.gbl...
It should be the same type of declaration as the original array. That's the only way to return it from the function without the "Invalid cast"
exception. I'm guessing this was a type-o...

dim returnarray(7) as String
"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news:18*****************************@40tude.net...
On Thu, 1 Apr 2004 20:59:13 +0200, Cor wrote:

Hi Cor
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

??

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail address.


Nov 20 '05 #13
That did it - typos suck! Thank you all!

Derek

"Scott" <sc*****@yahoo.com> wrote in message
news:uX**************@TK2MSFTNGP11.phx.gbl...
It should be the same type of declaration as the original array. That's the only way to return it from the function without the "Invalid cast"
exception. I'm guessing this was a type-o...

dim returnarray(7) as String
"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news:18*****************************@40tude.net...
On Thu, 1 Apr 2004 20:59:13 +0200, Cor wrote:

Hi Cor
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

??

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail address.


Nov 20 '05 #14
Cor
Hi Chris,
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

Of course typos, thank you to point the attention to it.

Cor
Nov 20 '05 #15
Cor
Hi Chris,
dim returnarray(7) as String()


Doesn't this line create an array of string arrays? Shouldn't it be:

Dim returnarray(7) As String

Of course typos, thank you to point the attention to it.

Cor
Nov 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ryan Sullivan | last post by:
I am using a PHP calendar with MySQL backend. For some reason, when you click on an event in the calendar (which brings up a pop-up window), there is a scrambled mess before the description. I...
9
by: Derek Martin | last post by:
Thanks in advance: Dim thisperson(7) As Array Dim validcheck As Boolean = False thisperson = getperson(usernametextbox.Text, pinnumbertextbox.Text) .... private function getperson(byval...
4
by: guy | last post by:
I am binding a datatable to a WinForms grid control but for some reason the GridTableStyle is being ignored, the data just displays as if no TableStyle was set up I have also tried changing the...
2
by: matt | last post by:
this is my first program in this language ever (besides 'hello world'), can i get a code critique, please? it's purpose is to read through an input file character by character and tally the...
2
by: Wayneyh | last post by:
Hi all I am having trouble getting some code working. Would someone please check the following code and tell me why it doesn't work. If additional info is required please ask. Thanks. ...
4
by: Wayneyh | last post by:
Hi All I am having a little problem with the following code. I can't seem to get it to go back to focus on the Contact field. Please Advise. Private Sub Contact_LostFocus() If...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.