Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get current value of label when timer stopped
    primarykey
    data
    text
    <p>Can't Update my User Table "Hours" "Minutes" "Seconds" from the current value of the timer where it has stopped. I used button to stop the time</p> <pre><code>Imports System.Data.OleDb Public Class frmMain Public hh As Integer Public mm As Integer Public ss As Integer Public totalsec As Integer Public timercount As Integer Public temp As Integer Dim cnn3 = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Renz\Documents\Visual Studio 2012\Internet Cafe Billing System\Database\Database1.accdb") Dim sql1 As String Dim Command1 As New OleDbCommand Dim i2 As Integer Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load Timer1.Enabled = True End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick lbltime.Text = Date.Now.ToString("hh:mm tt") 'live clock End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles btnLogin.Click frmLogin.Show() End Sub Private Sub btnEnd_Click(sender As Object, e As EventArgs) Handles btnEnd.Click btnEnd.FlatStyle = FlatStyle.Flat btnGames.FlatStyle = FlatStyle.Flat btnInternet.FlatStyle = FlatStyle.Flat btnLock.FlatStyle = FlatStyle.Flat btnOffice.FlatStyle = FlatStyle.Flat btnLogin.FlatStyle = FlatStyle.Standard btnEnd.ForeColor = Color.Gray btnGames.ForeColor = Color.Gray btnInternet.ForeColor = Color.Gray btnLock.ForeColor = Color.Gray btnOffice.ForeColor = Color.Gray btnLogin.ForeColor = Color.Black btnEnd.Enabled = False btnGames.Enabled = False btnInternet.Enabled = False btnLock.Enabled = False btnOffice.Enabled = False btnLogin.Enabled = True lblend.Text = Format(Now, "hh:mm tt") 'get stop time' Try cnn3.Open() sql1 = "UPDATE Users SET Hours = '" &amp; lblHours.Text &amp; "', Minutes = '" &amp; lblMinutes.Text &amp; "', Seconds = '" &amp; lblSeconds.Text &amp; "' WHERE ID = '" &amp; frmLogin.txtUsername.Text &amp; "'" Command1 = New OleDbCommand(sql1, cnn3) i2 = Command1.ExecuteNonQuery Catch ex As Exception frmLogin.ds = New DataSet 'reset dataset Timer2.Stop() cnn3.Close() End Try End Sub Private Sub lblRemaining_Click(sender As Object, e As EventArgs) End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick If lblHours.Text.Length &lt; 2 Then lblHours.Text = "0" &amp; lblHours.Text '// format from "0" to "00" '// verify Hours. If lblHours.Text &gt; "00" And lblMinutes.Text = "00" Then lblHours.Text -= 1 lblMinutes.Text = "60" End If If lblMinutes.Text.Length &lt; 2 Then lblMinutes.Text = "0" &amp; lblMinutes.Text '// format from "0" to "00" '// verify Minutes. If lblMinutes.Text &gt; "00" And lblSeconds.Text = "00" Then lblMinutes.Text -= 1 lblSeconds.Text = "60" End If If lblSeconds.Text.Length &lt; 2 Then lblSeconds.Text = "0" &amp; lblSeconds.Text '// format from "0" to "00" '// verify Seconds. If lblSeconds.Text &gt; "00" Then lblSeconds.Text -= 1 '// disable Timer. If lblHours.Text = "00" And lblMinutes.Text = "05" AndAlso lblSeconds.Text = "00" Then MsgBox("You only have 5 Minutes Remaining in your Account", MsgBoxStyle.Information) End If If lblHours.Text = "00" And lblMinutes.Text = "00" AndAlso lblSeconds.Text = "00" Then btnEnd.FlatStyle = FlatStyle.Flat btnGames.FlatStyle = FlatStyle.Flat btnInternet.FlatStyle = FlatStyle.Flat btnLock.FlatStyle = FlatStyle.Flat btnOffice.FlatStyle = FlatStyle.Flat btnLogin.FlatStyle = FlatStyle.Standard btnEnd.ForeColor = Color.Gray btnGames.ForeColor = Color.Gray btnInternet.ForeColor = Color.Gray btnLock.ForeColor = Color.Gray btnOffice.ForeColor = Color.Gray btnLogin.ForeColor = Color.Black btnEnd.Enabled = False btnGames.Enabled = False btnInternet.Enabled = False btnLock.Enabled = False btnOffice.Enabled = False btnLogin.Enabled = True lblend.Text = Format(Now, "hh:mm tt") 'get stop time' Try cnn3.Open() sql1 = "UPDATE Users SET ([Hours], [Minutes], [Seconds] = VALUES(' 00 ',' 00 ',' 00 ') WHERE ID = '" &amp; frmLogin.txtUsername.Text &amp; "'" Command1 = New OleDbCommand(sql1, cnn3) i2 = Command1.ExecuteNonQuery Catch ex As Exception cnn3.Close() End Try Timer2.Enabled = False frmLogin.ds = New DataSet 'reset dataset End If End Sub End Class </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload