변환 문제가 있습니다.초 단위 시간 변환
나는 카운트 다운 스톱워치를 가지고 있습니다. 그런 다음 라벨에 표시하여 ("label1")이 "15:00:00"처럼 표시됩니다.
나는 다른 시간 무릎에 루프 매 10 초마다 스톱워치를 가지고 있고 다른 레이블 (라벨 2)그래서 어떻게 15시 0분 0초셨어요에 겹침 시간을 절약?
내 양식에 3 개의 텍스트 상자가 있습니다. 1 시간은 1 시간이고, 2는 분, 2는 3 초입니다. 시간에 15를 입력하고 분과 초에 00을 입력하고 button1을 누르면 15시를 저장하는 대신 자동으로 15 시간 (15:00:00)을 데이터베이스에 저장된 초로 변환하므로 15시를 저장하는 대신 TotalSeconds 54000 초입니다.
스톱워치가 시작되면 데이터베이스에서 54000을 가져와 label1에 표시된 15:00:00으로 다시 변환합니다.
label2 ("13:00:00")의 lapped time을 초로 변환하여 변환 된 값을 다른 레이블 (이제 label3)로 표시 할 수 있습니까?
Imports System
Imports System.Timers
Public Class ClientDashboard
Dim StopWatch As New Stopwatch
Dim CountDown As TimeSpan
Dim IsRunning As Boolean = False
Private Shared timer As System.Timers.Timer
Private Sub ClientDashboard_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Sets dashboard to right
Me.Size = New System.Drawing.Size(317, 900)
Dim x As Integer
Dim y As Integer
x = Screen.PrimaryScreen.WorkingArea.Width - 317
y = Screen.PrimaryScreen.WorkingArea.Height - Screen.PrimaryScreen.WorkingArea.Height
Me.Location = New Point(x, y)
'get time of user
cn = New ADODB.Connection
Call conDB()
cn.Open()
Dim rs As New ADODB.Recordset
rs.Open("select * from tb_registration where=st_acc_number= '" & id_lbl.Text & "'", cn, 0, 3)
iduser_lbl.Text = "'" & rs("st_name").Value & "'""'" & rs("st_lname").Value & "'"
UserTotal.Text = rs("st_totaltimeleft").Value
'Start stopwatch
StopWatch.Start()
synchroUpdate.Enabled = True
synchroUpdate.Start()
Dim numSecs As Integer
Integer.TryParse(UserTotal.Text, numSecs)
CountDown = TimeSpan.FromSeconds(numSecs)
End Sub
Private Sub synchro_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles synchro.Tick
End Sub
'--------------------->>>> Methord 2 <<<<----------------------
Private Sub DispElaps(ByVal ts As TimeSpan, ByVal lbl As Label)
lbl.Text = String.Format("{0:00} : {1:00} : {2:00}", _
Math.Floor(ts.TotalHours), _
ts.Minutes, _
ts.Seconds, _
ts.Milliseconds)
End Sub
Private Sub synchroUpdate_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles synchroUpdate.Tick
synchroUpdate.Interval = 100
'If countDown > stpw.Elapsed Then
Dim elaps As TimeSpan = CountDown - StopWatch.Elapsed
DispElaps(elaps, TimerOutput)
'Else
'End If
End Sub
Private Sub DoEvent()
timer = New System.Timers.Timer(5000)
AddHandler timer.Elapsed, AddressOf AC
timer.AutoReset = True
timer.Enabled = True
End Sub
'Address of event
Private Sub SaveEvent2(ByVal sender As System.Object, ByVal e As EventArgs)
AutoUpdate_Button.PerformClick()
End Sub
'Event Handler
Private Sub AC()
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(AddressOf AC))
Else
Me.AutoUpdate_Button.PerformClick()
End If
End Sub
Private Sub logoutBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logoutBTN.Click
End Sub
End Sub
End Class
일부 코드보기 ... – OneFineDay
죄송합니다. 나는이 포럼에서 새로운데, 나와 친하게 지내라. :) –