Casting!!!?!?!?!?

  • Thread starter Thread starter André Almeida Maldonado
  • Start date 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
 
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.
 
Back
Top