I want the text in a combo box to always appear in the format 00000 i.e. if the number is 1 then I want it to appear as 00001
I have tried :
cbo1 = format(cbo1.text, "00000")
but it doesn't seem to work:rolleyes:
Any suggestions:confused: :confused:
Printable View
I want the text in a combo box to always appear in the format 00000 i.e. if the number is 1 then I want it to appear as 00001
I have tried :
cbo1 = format(cbo1.text, "00000")
but it doesn't seem to work:rolleyes:
Any suggestions:confused: :confused:
I tested this and it worked. Make sure you put that code in the validation or lost focus event.
This will place the FIRST item in the ComBoBox as Formated TEXT.
VB Code:
Private Sub Command1_Click() Combo1.Text = Format(Combo1.List(0), "000000") End Sub
This works too
VB Code:
Private Sub Form_Load() Combo1.Text = "1" End Sub Private Sub Command1_Click() Combo1.Text = Format(Combo1.Text, "000000") End Sub
But, ur not ADDING these Item (If u want to ADD us .AddItem)
Use this code
VB Code:
Dim i As Integer For i = 0 To Combo1.ListCount Combo1.List(i) = Format(Combo1.List(i), "00000") Next
:)Quote:
Originally posted by Ambivalentiowa
For i = 0 To Combo1.ListCount -1