Visual Basic - Error...No se encontro el.. pero el METODO EXISTE

Life is soft - evento anual de software empresarial
 
Vista:

Error...No se encontro el.. pero el METODO EXISTE

Publicado por Yecid Calderon (5 intervenciones) el 16/06/2010 00:43:25
Hola a todos,

Tengo una aplicacion donde utilizo la propiedad orientation del datereport para mostrar un informe en horizontal.
Hice algunos cambios a la aplicacion, pero que ni por casualidad afectan al datareport en cuestion, y partir de ese momento no puedo generar el ejecutable pues me me sale "error de compilacion no se encontro el metodo o el miembro de datos". Lo mas extraño es antes no se salia este error y compilaba sin problemas.
La linea que especificamente me presenta el error es la siguinete:

Private Sub DataReport_Initialize()
==> G57p2.Orientation = 2
End Sub

Alguna idea del porque y como lo soluciono???

Gracias

PD. utilizo VB6 con SP
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...No se encontro el.. pero el METODO EXIS

Publicado por Julio (72 intervenciones) el 16/06/2010 02:03:44
Hola soy Julio

G57p2 que es ?

a que hace referencia.

lo que te esta diciendo es que G57p2.Orientation no existe, osea la propiedad orientacion en el G57p2 no existe.

proba haciendo G57p2 acompañado de un punto para ver si te aparece la propiedad orientacion, si no te aparece en porque estas nombrando mal al objeto

Haber si soy claro es como si yo quisiera hacer text1.caption, la propiedad caption en los textbox no existen, si existen en los label

saludos Julio
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...No se encontro el.. pero el METODO EXIS

Publicado por Yecid Calderon (5 intervenciones) el 16/06/2010 15:35:41
Julio,

Gracias por la ayuda, te comento que G57p2 es un datareport y la propiedad orientation me parece que fue añadida con el sp6, lo raro es que todo andaba bien hasta hace unos dias.

No me explico cual puede ser el error.

Yecid
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...No se encontro el.. pero el METODO EXIS

Publicado por Julio (72 intervenciones) el 16/06/2010 16:56:41
EN UN MODULO PEGA ESTO

Option Explicit

Private Const CCHDEVICENAME = 32
Private Const CCHFORMNAME = 32

Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const PRINTER_ACCESS_ADMINISTER = &H4
Private Const PRINTER_ACCESS_USE = &H8
Private Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)

Private Const DM_MODIFY = 8
Private Const DM_IN_BUFFER = DM_MODIFY
Private Const DM_COPY = 2
Private Const DM_OUT_BUFFER = DM_COPY
Private Const DM_DUPLEX = &H1000&
Private Const DMDUP_SIMPLEX = 1
Private Const DMDUP_VERTICAL = 2
Private Const DMDUP_HORIZONTAL = 3
Private Const DM_ORIENTATION = &H1&
Private PageDirection As Integer

Private Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmLogPixels As Integer
dmBitsPerPel As Long
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
dmICMMethod As Long
dmICMIntent As Long
dmMediaType As Long
dmDitherType As Long
dmReserved1 As Long
dmReserved2 As Long
End Type

Private Type PRINTER_DEFAULTS
pDatatype As String
pDevMode As Long
DesiredAccess As Long
End Type

Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
Private Declare Function SetPrinter Lib "winspool.drv" Alias "SetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Any, ByVal Command As Long) As Long
Private Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Any, ByVal cbBuf As Long, pcbNeeded As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Private Declare Function DocumentProperties Lib "winspool.drv" Alias "DocumentPropertiesA" (ByVal hwnd As Long, ByVal hPrinter As Long, ByVal pDeviceName As String, ByVal pDevModeOutput As Any, ByVal pDevModeInput As Any, ByVal fMode As Long) As Long

Private Sub SetOrientation(NewSetting As Long, chng As Integer, ByVal frm As Form)
'*
On Error GoTo 1
'*
Dim PrinterHandle As Long
Dim PrinterName As String
Dim pd As PRINTER_DEFAULTS
Dim MyDevMode As DEVMODE
Dim Result As Long
Dim Needed As Long
Dim pFullDevMode As Long
Dim pi2_buffer() As Long

PrinterName = Printer.DeviceName
If PrinterName = "" Then
Exit Sub
End If

pd.pDatatype = vbNullString
pd.pDevMode = 0&

pd.DesiredAccess = PRINTER_ALL_ACCESS

Result = OpenPrinter(PrinterName, PrinterHandle, pd)


Result = GetPrinter(PrinterHandle, 2, ByVal 0&, 0, Needed)
ReDim pi2_buffer((Needed \ 4))
Result = GetPrinter(PrinterHandle, 2, pi2_buffer(0), Needed, Needed)


pFullDevMode = pi2_buffer(7)


Call CopyMemory(MyDevMode, ByVal pFullDevMode, Len(MyDevMode))


MyDevMode.dmDuplex = NewSetting
MyDevMode.dmFields = DM_DUPLEX Or DM_ORIENTATION
MyDevMode.dmOrientation = chng


Call CopyMemory(ByVal pFullDevMode, MyDevMode, Len(MyDevMode))

Result = DocumentProperties(frm.hwnd, PrinterHandle, PrinterName, ByVal pFullDevMode, ByVal pFullDevMode, DM_IN_BUFFER Or DM_OUT_BUFFER)


Result = SetPrinter(PrinterHandle, 2, pi2_buffer(0), 0&)

Call ClosePrinter(PrinterHandle)

Dim p As Printer
For Each p In Printers
If p.DeviceName = PrinterName Then
Set Printer = p
Exit For
End If
Next p
Printer.Duplex = MyDevMode.dmDuplex
Exit Sub
1:
Call Error
End Sub

Public Sub ChngPrinterOrientationLandscape(ByVal frm As Form)
'*
On Error GoTo 1
'*
PageDirection = 2
Call SetOrientation(DMDUP_SIMPLEX, PageDirection, frm)
Exit Sub
1:
Call Error
End Sub

Public Sub ChngPrinterOrientationPortrait(ByVal frm As Form)
'*
On Error GoTo 1
'*
PageDirection = 1
Call SetOrientation(DMDUP_SIMPLEX, PageDirection, frm)
'*
Exit Sub
1:
Call Error
End Sub

PARA LLAMAR A ESTE PROCEDIMIENTO DESCRIPTO ARRIBA:

PARA QUE TU DATAREPORT SE VEA HORIZONTAL

Private Sub Command1_Click()
'*
On Error GoTo 1
'*
'Aqui llama al procedimiento almacenado en el modulo
ChngPrinterOrientationLandscape Me
'*
DataReport4.Show
'*
Exit Sub
1:
Call Error
End Sub

PARA QUE TU DATAREPORT SE VEA VERTICAL

Private Sub Command2_Click()
'*
On Error GoTo 1
'*
'Aqui llama al procedimiento almacenado en el modulo
ChngPrinterOrientationPortrait Me
'*
DataReport4.Show
'*
Exit Sub
1:
Call Error
End Sub

ESTO FUNCIONA ALA PERFECCION YO LO UTILIZO SIEMPREEEEEE

SALUDOS JULIO
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...No se encontro el.. pero el METODO EXIS

Publicado por Yecid Calderon (5 intervenciones) el 16/06/2010 17:34:54
Julio,

Mil gracias por la ayuda, ahora lo pruebo y te cuento como me va.

Yecid
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...No se encontro el.. pero el METODO EXIS

Publicado por Luis T. (1 intervención) el 06/03/2012 10:51:38
Julio.
A mi también me sirvió tu ayuda...había probado con todo, descargar los SP para VB, registrar de nuevo la DLL del DataReport y nada...pero tu código si que funciona a la perfeccción.
Saludos y gracias.
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