Ten program má ukazovat jak dlouho běží PC, takže až se restartuje pc tak musí take běžet tento program se stejnýma hodnotami. Když použiju settings hází to chybu: převod řetězce na typ Double není platny... Nevim co to znamena Public Class Form1 Const mfilename As String = "C:\casovac\soubor.txt" Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Timer1.Start() Dim minuta As Integer = 0.0R Dim hodina As Integer = 0.0R Dim pocet As Integer = 0.0R Dim dnu As Integer = 0.0R Dim tydny As Integer = 0.0R Dim měsíce As Integer = 0.0R Dim roky As Integer = 0.0R loadData.Start() Label1.Text = pocet 'label1 se bude vzdy rovnat poctem sekund Label6.Text = hodina 'label6 se bude vzdy rovnat poctem hodin Label5.Text = minuta 'label5 se bude vzdy rovnat poctem minut Label12.Text = dnu 'label12 se bude vzdy rovnat poctem dnu Label11.Text = tydny 'label11 se bude vzdy rovnat poctem tydnu Label10.Text = tydny 'label10 se bude vzdy rovnat poctem tydnu Label13.Text = tydny 'label13 se bude vzdy rovnat poctem roky If Label1.Text = 10.0R Then minuta += 1 End If If Label5.Text = 10.0R Then hodina += 1 End If save.Start() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Label1.Text += 1 If Label10.Text = 12.0R Then 'ROKY TimeRok.Start() Label10.Text = 0 TimeMes.Stop() TimeMes.Start() End If If Label11.Text = 4.0R Then 'mesice TimeMes.Start() Label11.Text = 0 TimeTyd.Stop() TimeTyd.Start() End If If Label12.Text = 7.0R Then 'TYDNY TimeTyd.Start() Label12.Text = 0 TimeDnu.Stop() TimeDnu.Start() End If If Label1.Text = 60 Then 'SEKUNDY Timer1.Stop() Label1.Text = 0 TimeMin.Start() Timer1.Start() save.Start() End If If Label5.Text = 60 Then 'MINUTY TimeMin.Stop() TimeMin.Start() TimeHod.Start() Label5.Text = 0 End If If Label6.Text = 24 Then 'DNY TimeDnu.Start() TimeHod.Stop() TimeHod.Start() Label6.Text = 0 End If End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Label1.Text += 1 End Sub Private Sub TimeMin_Tick(sender As Object, e As EventArgs) Handles TimeMin.Tick 'TIMER ZPUSOBI , ŽE SE KE DNU PŘIČTE 1 MINUTA a tIMER SE ZASTAVI Label5.Text += 1 TimeMin.Stop() End Sub Private Sub TimeHod_Tick(sender As Object, e As EventArgs) Handles TimeHod.Tick 'TIMER ZPUSOBI , ŽE SE KE DNU PŘIČTE 1 HODINA A TIMER SE ZASTAVI Label6.Text += 1 TimeHod.Stop() End Sub Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles Button1.Click 'RESET CASOVACE NA 0 0 0 Label1.Text = 0 'VYNULOVANI SEKUND Label5.Text = 0 'VYNULOVANI MINUT Label6.Text = 0 'VYNULOVANI HODIN Label12.Text = 0 'VYNULOVANI DNŮ Label11.Text = 0 'VYNULOVANI TYDNU Label10.Text = 0 'VYNULOVANI mesicu Label13.Text = 0 'VYNULOVANI roku End Sub Private Sub save_Tick(sender As Object, e As EventArgs) 'PRUBEZNE UKLADANI CASOVACE My.Settings.hod = Label1.Text End Sub Private Sub TimeDnu_Tick(sender As Object, e As EventArgs) Handles TimeDnu.Tick 'TIMER ZPUSOBI , ŽE SE KE DNU PŘIČTE 1 DEN A TIMER SE ZASTAVI Label12.Text += 1 TimeDnu.Stop() End Sub Private Sub TimeTyd_Tick(sender As Object, e As EventArgs) Handles TimeTyd.Tick Label11.Text += 1 TimeTyd.Stop() End Sub Private Sub TimeMes_Tick(sender As Object, e As EventArgs) Handles TimeMes.Tick Label10.Text += 1 TimeMes.Stop() End Sub Private Sub TimeRok_Tick(sender As Object, e As EventArgs) Handles TimeRok.Tick Label13.Text += 1 TimeRok.Stop() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click End End Sub Private Sub save_Tick_1(sender As Object, e As EventArgs) Handles save.Tick My.Settings.sekundy = Label1.Text End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Dim fileReader As String fileReader = My.Computer.FileSystem.ReadAllText("C:\casovac\soubor.txt") Label1.Text = (fileReader) End Sub Private Sub loadData_Tick(sender As Object, e As EventArgs) Handles loadData.Tick Label1.Text = My.Settings.sekundy
|