K
Keith
Hello - this started out as a minor annoyance - and now is
starting to bother me more and more - I'm hoping someone
can help me.
I would like to have a combobox display - NOT initially be
blank - but contain a value. However the value is just
for user reference - not really one of the combobox
choices. For example intially the combobox should equal
the word Select - and the item values can be
say 'one', 'two', and 'three'.
I tried just typing in the text value - in the properties
of the combobox control/object - but that did not work.
Someone told me in order to display the value - it has to
be an existing part of the collection. Doesn't completely
make sense to me - because why have a Text properties
field of the control - if you can't use it (everytime you
fill something in - and leave that field - it's blanked
out)
So what I ended up doing was - adding the item to the:
Windows Form Designer Generated Code Section - something
like this:
Me.ComboBox1.Items.Add("Select")
Me.ComboBox1.Items.Add("one")
Me.ComboBox1.Items.Add("two")
Me.ComboBox1.Items.Add("three")
Me.ComboBox1.Location = New System.Drawing.Point
(8, 25)
Me.ComboBox1.Size = New System.Drawing.Size(220,
22)
Me.ComboBox1.Text = "Select"
Well - it works - but here's the real problem. Every now
and then (I think when I click on that combobox - or even
on the form somehow - to open the design) - it removes the
last line: Me.ComboBox1.Text = "Select".
So - sometimes I compile - and I get "Select" as the
initial default value for the combobox and other times - I
do not and I have to re-add it. Sure - minor annoyance -
but when you have to do this 10, 20, 30, 50 times - it
becomes a MAJOR annoyance.
Am I doing something wrong?
Can someone suggest a better way?
Thank you.
starting to bother me more and more - I'm hoping someone
can help me.
I would like to have a combobox display - NOT initially be
blank - but contain a value. However the value is just
for user reference - not really one of the combobox
choices. For example intially the combobox should equal
the word Select - and the item values can be
say 'one', 'two', and 'three'.
I tried just typing in the text value - in the properties
of the combobox control/object - but that did not work.
Someone told me in order to display the value - it has to
be an existing part of the collection. Doesn't completely
make sense to me - because why have a Text properties
field of the control - if you can't use it (everytime you
fill something in - and leave that field - it's blanked
out)
So what I ended up doing was - adding the item to the:
Windows Form Designer Generated Code Section - something
like this:
Me.ComboBox1.Items.Add("Select")
Me.ComboBox1.Items.Add("one")
Me.ComboBox1.Items.Add("two")
Me.ComboBox1.Items.Add("three")
Me.ComboBox1.Location = New System.Drawing.Point
(8, 25)
Me.ComboBox1.Size = New System.Drawing.Size(220,
22)
Me.ComboBox1.Text = "Select"
Well - it works - but here's the real problem. Every now
and then (I think when I click on that combobox - or even
on the form somehow - to open the design) - it removes the
last line: Me.ComboBox1.Text = "Select".
So - sometimes I compile - and I get "Select" as the
initial default value for the combobox and other times - I
do not and I have to re-add it. Sure - minor annoyance -
but when you have to do this 10, 20, 30, 50 times - it
becomes a MAJOR annoyance.
Am I doing something wrong?
Can someone suggest a better way?
Thank you.