Hier einmal meine Version
Spoiler anzeigen
VB.NET-Quellcode
- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
- Dim TimeNow As TimeSpan = Date.Now.TimeOfDay
- Label1.Text = TimeNow.ToString("hh\:mm\:ss")
- Dim StundeZBin As String = Convert.ToString(TimeNow.Hours \ 10, 2).PadLeft(2, "0"c)
- Dim StundeEBin As String = Convert.ToString(TimeNow.Hours Mod 10, 2).PadLeft(4, "0"c)
- Dim MinuteZBin As String = Convert.ToString(TimeNow.Minutes \ 10, 2).PadLeft(3, "0"c)
- Dim MinuteEBin As String = Convert.ToString(TimeNow.Minutes Mod 10, 2).PadLeft(4, "0"c)
- Dim SekundeZBin As String = Convert.ToString(TimeNow.Seconds \ 10, 2).PadLeft(3, "0"c)
- Dim SekundeEBin As String = Convert.ToString(TimeNow.Seconds Mod 10, 2).PadLeft(4, "0"c)
- 'Errechnete Binärwärte in die Radiobuttons übertragen
- 'Stunden Zehner
- rb_H_Z1.Checked = StundeZBin(1) = "1"
- rb_H_Z2.Checked = StundeZBin(0) = "1"
- 'Stunden Einer
- rb_H_E1.Checked = StundeEBin(3) = "1"
- rb_H_E2.Checked = StundeEBin(2) = "1"
- rb_H_E8.Checked = StundeEBin(1) = "1"
- rb_H_E8.Checked = StundeEBin(0) = "1"
- 'Minuten Zehner
- rb_M_Z1.Checked = MinuteZBin(2) = "1"
- rb_M_Z2.Checked = MinuteZBin(1) = "1"
- rb_M_Z4.Checked = MinuteZBin(0) = "1"
- 'Minuten Einer
- rb_M_E1.Checked = MinuteEBin(3) = "1"
- rb_M_E2.Checked = MinuteEBin(2) = "1"
- rb_M_E4.Checked = MinuteEBin(1) = "1"
- rb_M_E8.Checked = MinuteEBin(0) = "1"
- 'Sekunden Zehner
- rb_S_Z1.Checked = SekundeZBin(2) = "1"
- rb_S_Z2.Checked = SekundeZBin(1) = "1"
- rb_S_Z4.Checked = SekundeZBin(0) = "1"
- 'Sekunden Einer
- rb_S_E1.Checked = SekundeEBin(3) = "1"
- rb_S_E2.Checked = SekundeEBin(2) = "1"
- rb_S_E4.Checked = SekundeEBin(1) = "1"
- rb_S_E8.Checked = SekundeEBin(0) = "1"
- End Sub