elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


  Mostrar Mensajes
Páginas: 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21]
201  Programación / Programación Visual Basic / Re: Ayuda Error 92 en tiempo de Ejecucion en: 18 Junio 2010, 18:53 pm
No se que tratas de hacer pero estas seteando objetos varias veces, ademas utilizas un FIXIT: que no se que hara pero dice que el tipo de dato debe ser de "tipo de datos de enlace" por ahi debe estar el error.
Quizas haya un error en el bucle, quita el bucle principal For bucle = 1 To Val(Text4.Text) y solo ejecuta el codigo una vez como si el bucle fuera For bucle = 1 To 1
Por otro lado estas declarando un variable dentro de un bucle ahi podria estar el error.

Código:
Dim bucle As Long
Dim cantidad As String
Dim result

WebBrowser1.Navigate "http://uni3.zagamex.com.ar/game.php?page=buildings&mode=fleet"

For bucle = 1 To Val(Text4.Text)

  Set hangar = WebBrowser1.Document
  Set var_value = hangar.getelementbyid(Label20.Caption)
  var_value.Value = Val(Text3.Text)
  Set var_but = hangar.getelementbytagname("INPUT")
 
  'FIXIT: Declare 'result' con un tipo de datos de enlace en tiempo de compilación FixIT90210ae-R1672-R1B8ZE
  For Each result In hangar.getelementbytagname("INPUT")
     If result.Value = "Construir" Then var_but.Click
  Next

Next
202  Programación / Programación Visual Basic / Re: Ayuda Error 92 en tiempo de Ejecucion en: 17 Junio 2010, 22:38 pm
Parece que te falta alguna referencia no te acepta el var_value.Value como tipo object te esta obligando a agregar su referencia sea cual sea el objeto que quieres crear.

Prueba declarandolo asi Dim var_value y vb automaticamente declara el tipo correcto por otro lado lado al no declarar el tipo de dato siempre se declara como object.
203  Programación / Programación Visual Basic / Como exportar MSHFlexgrid1 a Excel? - Expertos en vb6.0 en: 17 Junio 2010, 22:27 pm
Tengo un codigo y funciona bien pero cuando el MSHFlexgrid1 tiene agrupaciones como en la imagen solo me imprime los encabezados Procesadores, Monitores, Televisores que pertenecen a la tabla categoria.



Código:
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection

Private Sub Command1_Click()

sSQL = "SHAPE {SELECT codcat,nomcat FROM categoria} AS CABECERA " & _
"APPEND ({SELECT codprod,nomprod,codcat FROM producto} AS DETALLE " & _
"RELATE codcat TO codcat) AS DETALLE"

rs.StayInSync = False
'cn.Open "Provider=MSDataShape.1;Extended Properties=Jet OLEDB:Database Password=;Persist Security Info=False;Data Source=c:\bd_01.mdb;Data Provider=MICROSOFT.JET.OLEDB.4.0"
 cn.Open "Provider=MSDataShape.1;Extended Properties=Jet OLEDB:Database Password=;Persist Security Info=False;Data Source=" & App.Path & "\bd_01.mdb;Data Provider=MICROSOFT.JET.OLEDB.4.0"
    
rs.Open sSQL, cn

Set MSHFlexGrid1.DataSource = rs

End Sub

Código:
Private Sub Command2_Click()
Call Exportar_HFlexgrid(App.Path & "\excel1.xls", MSHFlexGrid1)
End Sub


' -------------------------------------------------------------------------------------------
' \\ -- Función para crear un nuevo libro con el contenido del Grid
' -------------------------------------------------------------------------------------------
Public Function Exportar_HFlexgrid(sOutputPath As String, FlexGrid As Object) As Boolean
  
    On Error GoTo Error_Handler
  
    Dim o_Excel     As Object
    Dim o_Libro     As Object
    Dim o_Hoja      As Object
    Dim Fila        As Long
    Dim Columna     As Long
      
    ' -- Crea el objeto Excel, el objeto workBook y el objeto sheet
    Set o_Excel = CreateObject("Excel.Application")
    Set o_Libro = o_Excel.Workbooks.Add
    Set o_Hoja = o_Libro.Worksheets.Add
      
    ' -- Bucle para Exportar los datos
    With FlexGrid
        For Fila = 1 To .Rows - 1
            For Columna = 0 To .Cols - 1
                o_Hoja.Cells(Fila, Columna + 1).Value = .TextMatrix(Fila, Columna)
            Next
        Next
    End With
    o_Libro.Close True, sOutputPath
    ' -- Cerrar Excel
    o_Excel.Quit
    ' -- Terminar instancias
    Call ReleaseObjects(o_Excel, o_Libro, o_Hoja)
    Exportar_HFlexgrid = True
Exit Function
  
' -- Controlador de Errores
Error_Handler:
    ' -- Cierra la hoja y el la aplicación Excel
    If Not o_Libro Is Nothing Then: o_Libro.Close False
    If Not o_Excel Is Nothing Then: o_Excel.Quit
    Call ReleaseObjects(o_Excel, o_Libro, o_Hoja)
    If Err.Number <> 1004 Then MsgBox Err.Description, vbCritical
End Function
' -------------------------------------------------------------------
' \\ -- Eliminar objetos para liberar recursos
' -------------------------------------------------------------------
Private Sub ReleaseObjects(o_Excel As Object, o_Libro As Object, o_Hoja As Object)
    If Not o_Excel Is Nothing Then Set o_Excel = Nothing
    If Not o_Libro Is Nothing Then Set o_Libro = Nothing
    If Not o_Hoja Is Nothing Then Set o_Hoja = Nothing
End Sub





Páginas: 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines