Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to find the Timediff Equivalent in visual Bas
Message
From
06/05/2002 20:58:05
 
 
To
All
General information
Forum:
Visual Basic
Category:
Other
Title:
Is there a way to find the Timediff Equivalent in visual Bas
Miscellaneous
Thread ID:
00653334
Message ID:
00653334
Views:
75
Is there a way to find the Timediff Equivalent in visual Basic?

I want to develop an application to control the time that I use to be Online, and I am planning to set several buttons in this function so people can use it as a "Internet shop service time controler" if you guys know what I mean.

this is what I am using so far:

'the public variables to save the value of minutes returned to calculate
'teh time used in the session.

Public minutos As Long
Public resultado As Long
'a public function to save the data in the table

Public Function GuardarDatos(ByVal lngMyResultados As Long)
'primero validemos si no hay algun error en la ejecucion
'del query, si lo hay, validemoslo asi:
On Error GoTo manejador_errores
Dim Variable As Long
Dim myStrSQL As String
Variable = lngMyResultados
MsgBox "esto me pasaron por valor " & Variable
'veamos el contenido del SQL
myStrSQL = " INSERT INTO tbl_entradas" & _
"(username,producto,entradas,paises,fecha)" & _
"VALUES (" & _
"'Administrador del Sistema'" & _
"," & "'Uso del Internet'" & _
"," & Variable & _
"," & "' Nicaragua'" & _
"," & "#" & DateValue(Now) & "#)"
cn.Execute myStrSQL
MsgBox "Los datos fueron almacenados", vbInformation + vbOKOnly, App.Title
manejador_errores:
If Err.Description <> "" Then
MsgBox "No se pudo almacenar los datos del cliente:" & _
Chr(13) & "Descripcion del Error: " & Err.Description & _
Chr(13) & "Numero de error: " & Err.Number, vbCritical + vbOKOnly, "ERROR INESPERADO!"
Exit Function
End If
End Function

'now, right here I have two functions to calculate the payment, depending
'on the category of the user, that is, student price, and normal price

'student price, this function will solve it
Public Sub PrecioEstudiante(ByVal lngResult As Long)
'code will go here
MsgBox "El Total a pagar es de:" & lngResult & " Cordobas"
End Sub
'normal price, this function will solve it
Public Sub PrecioNormal(ByVal lngResult As Long)
'code will go here as to calculate the normal price
MsgBox "El Total a pagar es de:" & lngResult & " Cordobas"
End Sub

Private Sub cmd_Minimize_Click()
' a button to minimize the window
Me.WindowState = 1
End Sub

'this button will start the timer as to calculate the time used
Private Sub CmdUserStartTime_Click()
If CmdUserEndTime.Enabled = False Then
CmdUserEndTime.Enabled = True
End If
Me.txtStartTime.Text = TimeValue(Now)
Me.CmdUserStartTime.Enabled = False
Timer1.Enabled = True
End Sub

Private Sub CmdUserEndTime_Click()
Me.txtEndTime.Text = TimeValue(Now)
Me.CmdUserStartTime.Enabled = True
Me.CmdUserEndTime.Enabled = False
Timer1.Enabled = False
resultado = minutos * 2
MsgBox "Esta maquina hizo" & minutos & " minutos"
'what type of category to pay?
If MsgBox("Desea aplicar precio de estudiante a este cliente? ", vbQuestion + vbYesNo, "Atencion:") = vbYes Then
PrecioEstudiante (resultado)
Else
PrecioNormal (resultado)
End If
GuardarDatos (resultado)
minutos = 0
End Sub

Private Sub Form_Load()
'initialize the variable in zero
minutos = 0
End Sub

Private Sub Timer1_Timer()
minutos = minutos + 1
End Sub

'this timer is to put the time value in the form caption
Private Sub tmr_Hora_Timer()
Me.Caption = "Usuarios Activos: " & TimeValue(Now)
End Sub


let me know friends, since I want to use an equivalent for TIMEDIFF function in pearl.

Thanks!
Reply
Map
View

Click here to load this message in the networking platform