I've this very stupid litle problem. I want to populate a combobox with numbers ranging from 00 to 99. But when I ad them with a loop as an integer the first ten numbers apear only with one digit.
I wonder, how can I ad a second digit to them like; 00, 01, 02... and so on without me typing the whole list?
Does anyone know a litle trick to this?

Thnx in advance.

Recommended Answers

All 2 Replies

See if this helps.

ComboBox1.Items.Clear() '// clear for new input.
        For i As Integer = 0 To 99
            '// since you will get more #'s that are greater than 9, use "If Not" first.
            If Not i < 10 Then ComboBox1.Items.Add(i) Else ComboBox1.Items.Add("0" & i)
        Next

Wow this realy works fantastic :)
Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.