Salu2,
Tengo un problema de reflection con FieldInfo.Setvalue. En el codigo
siguiente( es pequeñito :) ) en la linea donde trata de setear el
valor lanza esta excepcion:Message "Object type cannot be converted to
target type." String...
Public Function CargarReflectedForm(ByVal PATH As String, ByVal
classname As String, ByRef frm As Form)
Dim a As [Assembly] = [Assembly].LoadFrom(PATH)
Dim mytype As Type
Dim tran As Object
Dim prop As Object
Dim f As Form
'Get the type to use.
mytype = a.GetType(classname)
tran = Activator.CreateInstance(mytype)
Dim finfo() As FieldInfo
finfo = mytype.GetFields(BindingFlags.Instance Or
BindingFlags.Public)
Dim sOut As String()
ReDim sOut(fInfo.GetLength(0) - 1)
For i As Integer = 0 To finfo.GetLength(0) - 1
If finfo(i).Name = "DBLX" Then
finfo(i).SetValue(tran, DBLX)
End If
If finfo(i).Name = "DBL" Then
finfo(i).SetValue(tran, DBL)
End If
If finfo(i).Name = "PARAMETERSENV" Then
finfo(i).SetValue(tran, PARAMETERSENV)
End If
If finfo(i).Name = "SAMB" Then
finfo(i).SetValue(tran, SAMB)
End If
Next
frm = tran
End Function
Gracias de antemano...
Leer las respuestas