Visual Basic Foro
General => General => Mensaje iniciado por: daviel en Junio 21, 2010, 06:47:13 pm
-
Buenas a todos, esta ves es sencilla mi duda, tengo una funcion que me carga de una base de datos unas fechas determinadas al hacer el onload del form principal, y si alguna de las fechas obtenidas corresponde al dia actual, pues que me hace el evento tick de un timer(name=timer_panel),
simplemente hago :
timer_panel.start()
Dentro del codigo del evento tick compruebo la hora del sistema hasta que sea igual a una hora que obtengo de una bd, pero no realiza nada.. Sera que mi forma de plantearlo esta mal¿?
Aqui os dejo las funciones de las que les hable
Dim max_row As Integer = estado.MAX - 1
Dim array(0 To max_row, 0 To 2) As String
Dim sub_array(0 To 2) As String
Sub bucle_fecha()
MsgBox("this is una prueba para saber que entro en la funcion bucle fecha")
estado.max_row()
max_row = estado.MAX - 1
For a As Integer = 0 To max_row Step 1
estado.mensajes_estado(a)
array(a, 0) = estado.ESTADO
array(a, 1) = estado.FECHA
array(a, 2) = estado.PAREJAN
Next
For a As Integer = 0 To max_row Step 1
If array(a, 2) = Date.Today Then
timer_panel.Enabled = True
timer_panel.Interval = 1000
timer_panel.Start()
End If
Next
End Sub
Function hora_return(ByVal id)
herramienta.puesta(id)
Return herramienta.ACCION1
End Function
Sub timer_panel_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim cantidad As Integer = (array.Length / 3) - 1
Dim hora As String = hora_return(2)
For a As Integer = 0 To cantidad Step 1
If array(a, 0) = "puesta" Then
If Date.Now = CDate(hora) Then
'ejecutar ventanita
End If
End If
If array(a, 0) = "mirar" Then
If Date.Now = CDate(hora) Then
'ejecutar ventanita
End If
End If
If array(a, 0) = "nacimiento" Then
If Date.Now = CDate(hora) Then
'ejecutar ventanita
End If
End If
If array(a, 0) = "anillar" Then
If Date.Now = CDate(hora) Then
'ejecutar ventanita
End If
End If
Next
End Sub
Solucionado.. Cambie de lugar la declaracion de variables y las puse en el mismo sub y funciono a la perfeccion..