@xtts02:: Warum so kompliziert, und so untypisiert? probierma:
probiers aus - enum.Tostring ist nett!
VB.NET-Quellcode
- <Flags()> Enum Wochentage
- Kein = 0
- Montag = 1
- Dienstag = 2
- Mittwoch = 4
- Donnerstag = 8
- Freitag = 16
- Samstag = 32
- Sonntag = 64
- End Enum
- Dim _AlleWochenTage As Wochentage() = DirectCast([Enum].GetValues(GetType(Wochentage)), Wochentage())
- Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles Me.Load
- Me.ListBox1.DataSource = _AlleWochenTage
- Me.ListBox1.SelectionMode = SelectionMode.MultiSimple
- End Sub
- Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
- Dim wts = Wochentage.Kein
- For Each indx As Integer In ListBox1.SelectedIndices
- wts = wts Or _AlleWochenTage(indx)
- Next
- MessageBox.Show(wts.ToString)
- End Sub