By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,188 Members | 1,775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,188 IT Pros & Developers. It's quick & easy.

How to prevent enter data into a combobox control?

P: n/a
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net

Thanks
Nov 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
RDI
Why can't you set it to "Dropdown List"?

"Li Pang" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net

Thanks

Nov 20 '05 #2

P: n/a
RDI
Why can't you set it to "Dropdown List"?

"Li Pang" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net

Thanks

Nov 20 '05 #3

P: n/a
Cor
Hi Li Pang,

You did post this before to this newsgroup I thought.

The text with the dropdownstyle =dropdownlist is

The user cannot directly edit the text portion.
The user must click the arrow button to display the list portion.

When I tried it, it did act like this.

I don't see your problem, what behaviour you want from the box?

(Or did you set it maybe to dropdown?)

Cor
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net

Thanks

Nov 20 '05 #4

P: n/a
Cor
Hi Li Pang,

You did post this before to this newsgroup I thought.

The text with the dropdownstyle =dropdownlist is

The user cannot directly edit the text portion.
The user must click the arrow button to display the list portion.

When I tried it, it did act like this.

I don't see your problem, what behaviour you want from the box?

(Or did you set it maybe to dropdown?)

Cor
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net

Thanks

Nov 20 '05 #5

P: n/a
* "Li Pang" <an*******@discussions.microsoft.com> scripsit:
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net


Change the system color settings.

SCNR

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

P: n/a
Hi Cor,

Think about textbox ReadOnly property. In the case of
ComboBox, I don't want users to CHANGE nor to EDIT the
text, ie the arrow button MUST be disabled, just like
disable the control.

DISABLED = false can resolve my problem, but it's hard to
read the text because the color is gray.

I posted this issue the second time, because most of
people can't understand me.

Thanks for your help.
-----Original Message-----
Hi Li Pang,

You did post this before to this newsgroup I thought.

The text with the dropdownstyle =dropdownlist is

The user cannot directly edit the text portion.
The user must click the arrow button to display the list portion.
When I tried it, it did act like this.

I don't see your problem, what behaviour you want from the box?
(Or did you set it maybe to dropdown?)

Cor
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net

Thanks

.

Nov 20 '05 #7

P: n/a
i think i finally got you ;)

but i do have an extra question
why whould you need a combobox if you don't want your users to choose an
element? wouldn't a textbox be better for this?
alternative would be using dropdownstyle = dropdownlist as cor suggested and
make sure there is only 1 element in the list.

eric

"Li Pang" <li*****@eu.altria.com> wrote in message
news:01****************************@phx.gbl...
Hi Cor,

Think about textbox ReadOnly property. In the case of
ComboBox, I don't want users to CHANGE nor to EDIT the
text, ie the arrow button MUST be disabled, just like
disable the control.

DISABLED = false can resolve my problem, but it's hard to
read the text because the color is gray.

I posted this issue the second time, because most of
people can't understand me.

Thanks for your help.
-----Original Message-----
Hi Li Pang,

You did post this before to this newsgroup I thought.

The text with the dropdownstyle =dropdownlist is

The user cannot directly edit the text portion.
The user must click the arrow button to display the list

portion.

When I tried it, it did act like this.

I don't see your problem, what behaviour you want from

the box?

(Or did you set it maybe to dropdown?)

Cor
I use a combobox control to populate the data. I want to
prevent to change data (freeze the data in the filed).
The only solution I have is to set Enabled property
to "False", but it gray out the field.

The question is how to change the color back to white?
Set the style property to "Dropdown List" is not an
optional. Is there is another way to fix it. There is a
solution in C++. But I need the codes in VB.Net

Thanks

.

Nov 20 '05 #8

P: n/a
Cor
Hi Li Pang,

In addition to Eric

Why not make 2 comboboxes (I was thinking about one combobox and one
textbox, but reading Erics text I think combinating both answer is the best
solution).

One is filled with 1 item and the other with all.
You put them on the same place
When needed you hide and show the one you want to use.

I think this fits totaly your problem.

Cor
Think about textbox ReadOnly property. In the case of
ComboBox, I don't want users to CHANGE nor to EDIT the
text, ie the arrow button MUST be disabled, just like
disable the control.

DISABLED = false can resolve my problem, but it's hard to
read the text because the color is gray.

Nov 20 '05 #9

P: n/a
Hi Cor and Eric,

Firstly, I'd like to thanks both you for your effort.
Secondly, I want let you know that I got the solution
already by meself as follows:
ComboBox1.BackColor = System.Drawing.Color.White
ComboBox1.Enabled = False
Thirdly, I explain your questions:
My stupid app uses a combobox to dosplaying data from a
listview. If user has permission then the data on the
combobox can be changed otherwise it is remained
in "Readonly" mode. Using a combobox is because it is
preloaded some values, ie. collection items are not empty.
So for the user has the permission, he/she can just change
the data within the collection items.

Sorry, I hadn't explained you the details.
-----Original Message-----
Hi Li Pang,

In addition to Eric

Why not make 2 comboboxes (I was thinking about one combobox and onetextbox, but reading Erics text I think combinating both answer is the bestsolution).

One is filled with 1 item and the other with all.
You put them on the same place
When needed you hide and show the one you want to use.

I think this fits totaly your problem.

Cor
Think about textbox ReadOnly property. In the case of
ComboBox, I don't want users to CHANGE nor to EDIT the
text, ie the arrow button MUST be disabled, just like
disable the control.

DISABLED = false can resolve my problem, but it's hard to read the text because the color is gray.

.

Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.