Casting!!!?!?!?!?

  • Thread starter André Almeida Maldonado
  • Start date
A

André Almeida Maldonado

Hi,

I need to pass an array to my class property and when I call the class
constructor, I receive a cast error: "Conversion not specified"

I am declaring my array of the following way:

Dim arrCampos() as String

and my constructor is:

Public Sub New(ByVal strCons As String, ByVal arrArray As Object)

prpRelaCons = strCons

prpRelaCamp = arrArray ' ************************ ERROR LINE
*********************

End Sub

Somebody knows wherre is the error?

Marcus
 
K

Kevin Spencer

You didn't specify what data type "prpRelaCamp" is, and I am assuming that
the reference to the input parameter "arrArray" is going to be your
"arrCampos" array. However, note that the data type specified for this
parameter in your Sub definition is "Object" - NOT "String()". Therefore, it
is not the same data type as a string array unless you cast it as such.
Using "Object" for an input parameter data type is not useful unless you are
expecting any of several different data types to be passed through that
parameter. Instead, if you're expecting a string array, specify that as the
data type.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top