• Jueves 16 de Mayo de 2024, 21:42

Autor Tema:  Re: Ayuda en Multiplicacion.  (Leído 875 veces)

pelotita

  • Nuevo Miembro
  • *
  • Mensajes: 21
    • Ver Perfil
Re: Ayuda en Multiplicacion.
« en: Martes 9 de Septiembre de 2003, 17:53 »
0
Hola quiero hacer una multiplicacion de fechas y que me de el dato exacto, pero aunque ya declare ciertas variables  no me da resultado a nada.  :no:
les publico el codigo, haber si me pueden ayudar.

Begin VB.Form Form1
   BorderStyle     =   5  'Sizable ToolWindow
   Caption         =   "Traficant Kitty"
   ClientHeight    =   2385
   ClientLeft      =   60
   ClientTop       =   300
   ClientWidth     =   6270
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2385
   ScaleWidth      =   6270
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text4
      Height          =   405
      Left            =   2880
      TabIndex        =   8
      Top             =   1320
      Width           =   2175
   End
   Begin VB.CommandButton Command1
      Caption         =   "Tratar De Calcular"
      Height          =   375
      Left            =   3120
      TabIndex        =   7
      Top             =   1920
      Width           =   1815
   End
   Begin VB.TextBox Text3
      Height          =   375
      Left            =   240
      TabIndex        =   5
      Top             =   1080
      Width           =   1575
   End
   Begin VB.TextBox Text2
      Alignment       =   2  'Center
      Height          =   375
      Left            =   2520
      TabIndex        =   2
      Top             =   480
      Width           =   1335
   End
   Begin VB.TextBox Text1
      Alignment       =   2  'Center
      Height          =   375
      Left            =   4200
      TabIndex        =   0
      Top             =   480
      Width           =   1455
   End
   Begin VB.Label Label4
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Diferencia de Tiempo"
      BeginProperty Font
         Name            =   "MS Sans Serif"
         Size            =   8.61
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Left            =   3120
      TabIndex        =   6
      Top             =   1080
      Width           =   1830
   End
   Begin VB.Label Label3
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Hora Actual"
      BeginProperty Font
         Name            =   "MS Sans Serif"
         Size            =   8.61
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Left            =   2640
      TabIndex        =   4
      Top             =   240
      Width           =   1020
   End
   Begin VB.Label Label2
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Hora Inicio"
      BeginProperty Font
         Name            =   "MS Sans Serif"
         Size            =   8.61
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Left            =   4560
      TabIndex        =   3
      Top             =   240
      Width           =   945
   End
   Begin VB.Label Label1
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "-"
      BeginProperty Font
         Name            =   "MS Sans Serif"
         Size            =   25.05
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   555
      Left            =   3960
      TabIndex        =   1
      Top             =   360
      Width           =   180
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim TimeIni, TimeFinal, TimeRes As Date
Private Sub Command1_Click()
TimeFinal = Time
Text2 = TimeFinal
TimeRes = TimeFinal - TimeIni
Text3 = TimeRes
Text4 = Hour(TimeRes) & ": " & Minute(TimeRes) & ": " & Second(TimeRes)
' Tal vez la cosa venga por usar el datediff, pero al ver la ayuda del MSDN no figuraba mas que solo poner fechas... vos diras
' Salu2
End Sub
Private Sub Form_Load()
 TimeIni = Time
 Text1 = TimeIni
 End Sub

Type=Exe
Form=Form1.frm
Reference=*G{00020430-0000-0000-C000-000000000046}#2.0#0#....SYSTEMstdole2.tlb#OLE Automation
IconForm="Form1"
Startup="Form1"
Command32=""
Name="Proyecto1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="C & C"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
Form1 = 84, 2, 565, 394, Z, 21, 21, 471, 298, C

chiaravel

  • Miembro MUY activo
  • ***
  • Mensajes: 242
    • Ver Perfil
Ayuda en Multiplicacion.
« Respuesta #1 en: Martes 9 de Septiembre de 2003, 18:22 »
0
Por lo que veo en tu ejemplo, lo que estas buscando es poder determinar el lapso de tiempo entre 2 horas.

La solucion es esta.

Dim ini As Date, final As Date, resto As Date
----------------------------------------------------
Private Sub Command1_Click()
final = Time
resto = (final - ini)
MsgBox Format$(resto, "hh:mm:ss")
End Sub
------------------------------------------------------
Private Sub Form_Load()
ini = Time
End Sub


Suerte, espero que te sirva

:good:
Pablo Tilotta
Analista de Sistemas
Argentina