Visual Basic - Error ByRef

Life is soft - evento anual de software empresarial
 
Vista:

Error ByRef

Publicado por Kenos (35 intervenciones) el 03/04/2008 17:57:34
Hola, tengo una aplicación en VB y cuando la ejecuto y trato de ver un formulario me da el error "el tipo de argumento ByRef no coincide"... ¿a qué se deberá?

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Error ByRef

Publicado por Augusto (158 intervenciones) el 03/04/2008 18:05:29
El problema que el tipo de parámetro que le estás mandando no coincide con el definido en la función, p.ej.:

Public Sub Suma(Numero1 as integer, Numero2 as integer, Resultado as integer)
Resultado = Numero1 + Numero2
end Sub

AL momento de llamarla la llamas

dim lbResultado as boolean
Suma(1,2, lbResultado)

Mira como en la definicion de la funcion tienes el parametro RESULTADO de tipo entero y al llamar la funcion lo hacemos con la variable LBRESULTADO la cual definimos como de tipo BOOLEANO.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar

RE:Error ByRef

Publicado por Kenos (35 intervenciones) el 03/04/2008 18:13:41
El problema es que esta aplicación es antigua y funciona... ahora no sé si será algun problema de versión o algo más.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Augusto (158 intervenciones) el 03/04/2008 18:30:23
Perdón pero nunca he visto que marque ese error sin fundamento.

Talvez estas en un caso que nuca había ocurrido, te propongo que pogas la cabecera de la definición de la función y la línea donde la llamas con la declaración de las variables que le pases como parametro.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Kenos (35 intervenciones) el 03/04/2008 19:09:51
Private Sub Form_Load()
Me.Move 0, 0, 11580, 7620
Call CenterForm(Me)

lvalida = True
VSP_Doc.MaxRows = 25
Call VSP_Doc.DeleteRows(1, VSP_Doc.MaxRows): VSP_Doc.MaxRows = 25
Call VSP_DetPend.DeleteRows(1, VSP_DetPend.MaxRows): VSP_DetPend.MaxRows = 15


DTPFecha.Value = Date
DTPFecha.Enabled = False
CmdAyudaGD.Enabled = True
CmdAnulaDocto.Enabled = False
Call ProtegeVS_grilla(VSP_Doc) <---- acá me marca el error VSP_Doc as variant --->

cmbBodega.Clear
cmbBodega.AddItem "Punto Venta:" & Trim(Nombre_Local) & Space(100) & "^" & Trim(cCodPtoVta_Local)
cmbBodega.ListIndex = 0


Set rs = ExecSp("BP", "UnidadMedida_Bodega_Lista", GetDSN(1), True)
VSP_DetPend.MaxCols = nColGD_UMIni
nColUmed = nColGD_UMIni - 1
ntoanchoUm = 0
Do While Not rs.EOF
nColUmed = nColUmed + 1
VSP_DetPend.MaxCols = nColUmed
Call VSP_DetPend.SetText(nColUmed, -1000, rs!Nom_Umed)
VSP_DetPend.ColWidth(nColUmed) = 4.38: ntoanchoUm = ntoanchoUm + 4.38
rs.MoveNext
Loop
VSP_DetPend.MaxCols = nColUmed + 7

difAncDes = 4.38 * 7 - ntoanchoUm
VSP_DetPend.ColWidth(nColNV_Des) = 16 + difAncDes

nColNV_Tot = nColUmed + 1: Call VSP_DetPend.SetText(nColNV_Tot, -1000, "Total")
VSP_DetPend.ColWidth(nColNV_Tot) = 4.5

nColNV_Uni = nColUmed + 2: Call VSP_DetPend.SetText(nColNV_Uni, -1000, "Prec.Unit")
VSP_DetPend.ColWidth(nColNV_Uni) = 6

nColNV_STo = nColUmed + 3: Call VSP_DetPend.SetText(nColNV_STo, -1000, "Sub-Total")
VSP_DetPend.ColWidth(nColNV_STo) = 8
VSP_DetPend.BlockMode = True
VSP_DetPend.Row = -1: VSP_DetPend.Row2 = -1: VSP_DetPend.Col = nColGD_UMIni: VSP_DetPend.Col2 = nColUmed + 3
VSP_DetPend.CellType = SS_CELL_TYPE_NUMBER
VSP_DetPend.TypeTextOrient = SS_CELL_TEXTORIENT_HORIZONTAL
VSP_DetPend.TypeEllipses = False
VSP_DetPend.TypeHAlign = SS_CELL_H_ALIGN_RIGHT
VSP_DetPend.TypeVAlign = SS_CELL_V_ALIGN_TOP
VSP_DetPend.TypeNumberMin = "0.00"
VSP_DetPend.TypeNumberMax = "100000000.00"
VSP_DetPend.TypeNumberShowSep = True
VSP_DetPend.TypeNegRed = False
VSP_DetPend.TypeSpin = False
VSP_DetPend.TypeSpinWrap = False
VSP_DetPend.TypeSpinInc = "1.10"
VSP_DetPend.TypeNumberDecPlaces = 0
VSP_DetPend.TypeNumberLeadingZero = SS_LEADZERO_INTERNATIONAL
VSP_DetPend.TypeNumberNegStyle = SS_NUMBER_NEGSTYLE_INTL
VSP_DetPend.TypeNumberDecimal = ","
VSP_DetPend.TypeNumberSeparator = "."
VSP_DetPend.BlockMode = False


nColNV_Fam = nColUmed + 4: Call VSP_DetPend.SetText(nColNV_Fam, -1000, "nColGD_Fam")
VSP_DetPend.Col = nColNV_Fam: VSP_DetPend.ColHidden = True

nColNV_FilaNV = nColUmed + 5: Call VSP_DetPend.SetText(nColNV_Fam, -1000, "nColGD_Fam")
VSP_DetPend.Col = nColNV_FilaNV: VSP_DetPend.ColHidden = True

nColNV_NV = nColUmed + 6: Call VSP_DetPend.SetText(nColNV_Fam, -1000, "nColGD_Fam")
VSP_DetPend.Col = nColNV_NV: VSP_DetPend.ColHidden = True

nColNV_IteFila = nColUmed + 7: Call VSP_DetPend.SetText(nColNV_Fam, -1000, "nColGD_Fam")
VSP_DetPend.Col = nColNV_IteFila: VSP_DetPend.ColHidden = True


Call cmbBodega_Click

End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Augusto (158 intervenciones) el 03/04/2008 20:06:07
VSP_Doc es Variant pero al momento de mandar error tiene un tipeo dependiendo del valor que se le halla asignado. Tu función ProtegeVS_grilla de que tipo espera el parámetro.

Se me ocurre que esperas un MSFlexGrid y le mandas un DBGrid, los objetos son parecidos pero no iguales.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Kenos (35 intervenciones) el 03/04/2008 20:47:31
Y lo más raro todavía es que las grillas no se ven en el formulario, estan como ocultas o encriptadas.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Kenos (35 intervenciones) el 03/04/2008 23:13:38
Ahora me da un error en Set rs = ExecSp(cParam, "Atributo_Familia_Lista", GetDSN(1), True)
ReDim aNomColPRod(0): ReDim aCodColPRod(0)
If Not rs.EOF Then
aca--->( VSProd.MaxCols) = 0: i = 1: nancho = 0: Pos_Ini = 3
hlp_Cod1 = ""
Do While Not rs.EOF
VSProd.MaxCols = i


me dice que se requiere un objeto... lo raro es que el programa donde está instalado funciona... pero el código fuente cuando lo quiero probar y crear el ejecutable con las modificaciones me da el error.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Augusto (158 intervenciones) el 03/04/2008 23:38:46
Que me late que mas bien te faltan componentes en tu maquina de desarrollo.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Kenos (35 intervenciones) el 04/04/2008 00:13:24
Puede ser... ahora ¿cómo puedo saber que componentes son?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error ByRef

Publicado por Augusto (158 intervenciones) el 04/04/2008 01:37:17
Checa en el menu Proyecto->Referencias si ves que alguna dice MISSING.

O si al cargar te marca un error al cargar un formulario, otra es que te quite un control y te ponga en su lugar un control Picture.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar