473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to prevent enter data into a combobox control?

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
9 20190
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
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
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
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
* "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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Danny | last post by:
I have a combo box look up and list items in a table, it is not bound. It works fine but how can I prevent the users from entering in there own data? i have an 'on change' event that when it...
3
by: RR | last post by:
What would the proper way be to enter a sale, then be able to enter 1 or more sales persons, their "costs" to the sale, and their commission on the sale? Then after its been entered, have all the...
8
by: ShyGuy | last post by:
Is it possible to use code to enter some text into a combo box and then have the cursor placed at the end of the text for more imput?
0
by: Li Pang | last post by:
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...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
3
by: GS | last post by:
If I were to capture enter key on keyup event of an GUI object like comboBox box, How do I avoid killing ctrol-c, controlv, controlx, shift-insert, shiftdelete, contrl-insert
3
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent...
5
by: Vincent | last post by:
I have a bound listbox control on one of my forms that has an associated afterupdate event. When this event is invoked, I lock the control to prevent the user from clicking on it more than once....
4
by: kveerendrareddy | last post by:
Hi friends, In my web page i have to create a combobox in HTML+JavaScript. The nature of that combobox should be such that it should allow the user to enter the data in the combobox...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.