473,394 Members | 1,722 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,394 software developers and data experts.

uneditable comboBox

I was wondering if anyone knew how to make a comboBox that cannot be
edited, but works in every other way. I have tried setting the
<comboBox name>.Enabled to false, but then I can't use the comboBox. I
merely want a way to have a comboBox with multiple items that can be
choosen from the drop down, but not allow text to be entered. Another
idea I had was to capture every keystroke, but that's a lot of
computing and my UI is already pretty intense. Any ideas would be
greatly appreciated.

Nov 17 '05 #1
3 11365

<ju***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I was wondering if anyone knew how to make a comboBox that cannot be
edited, but works in every other way. I have tried setting the
<comboBox name>.Enabled to false, but then I can't use the comboBox. I
merely want a way to have a comboBox with multiple items that can be
choosen from the drop down, but not allow text to be entered. Another
idea I had was to capture every keystroke, but that's a lot of
computing and my UI is already pretty intense. Any ideas would be
greatly appreciated.


Try setting <comboBox name>.DropDownStyle = ComboBoxStyle.DropDownList

Nov 17 '05 #2
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote:
[non-editable ComboBox]


Try setting <comboBox name>.DropDownStyle =
ComboBoxStyle.DropDownList


Alternatively, if you want the *application* to be able to put
non-standard values in the box, but not the user, you need to override
various events, such as KeyDown, and do "e.Handled = true" so that the
event won't propagate. Make sure you handle things like Ctrl+V for
pasting text.

P.
Nov 17 '05 #3
Thanks, I had thought of catching the events. I did not want to do that
b/c of how much I already have going on in my UI. Daniel's idea of just
setting the DropDownStyle to DropDownList worked perfectly. It makes
sense now that I think about it, but I still don't know why there isn't
a ReadOnly attribute. Oh well, thanks a lot!

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Shelly | last post by:
Here is a simple one. How do you make a text field uneditable? Shelly
7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
1
by: anonymous | last post by:
I've been trying to put a them, please help me out. Here's the major parts of my code: public Form1() { DataSet myDataSet = new DataSet("myDataSet"); DataTable testTable = new...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
0
by: SixStringSlaya | last post by:
I am trying to write a text to a cell in the Detailsview after the user clicks on New. When I do this, the Detailsview makes that cell uneditable. How do I get that cell back into the edit mode...
5
by: manishamca | last post by:
i want to make the chociebox uneditable that is the option selected shuld not change after we click a button... plz help me. Thanx in advance
2
by: premMS143 | last post by:
Hi Everybody, I've created a power point presentation which contains COmputer Fundamentals. Anyone with basic computer knowledge can learn MS-Office with the help of this presentation. That one...
4
by: premMS143 | last post by:
Could anybody help me how to make PPT file Uneditable, so that users can only read that PPT file. I already converted it to pps & make a package usoing 'Package for CD". But still it can be...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.