473,325 Members | 2,442 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,325 software developers and data experts.

C# Combobox question

I haven't been coding much... if at all lately and i just picked up some VS2005 C# again and i was wondering if i can make a combobox not be able to change the text in it, like make it read-only... I have taken a while to look it over and I can't figure out the property or code to do it. thanks for your help.
Sep 19 '07 #1
6 1038
Shashi Sadasivan
1,435 Expert 1GB
You can make its Enabled property to be set to False. This way it stays Read Only !!!
Cheers
Sep 19 '07 #2
ya i tried that already, but i want to be able to still go through the combobox, i just don't want the text changed... sorry if i didn't make it clear in my first post. Thanks again.
Sep 19 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
You might need to work around this.
Unfortunately it does not have events which can handle changing of indexes.
You might want to use the indexChanged Event.
But before that you should create a variable to store the value of the text, and on the Indexchanged event restore the text back to the original one!!

cheers
Sep 19 '07 #4
Shashi Sadasivan
1,435 Expert 1GB
As i suspected.
Someone had a solution for it.
Here you go
cheers
Sep 19 '07 #5
wow sorry it took so long for me to get back to you. I have been really busy with schoolwork... I had stupid essays due... I hate how im taking computer science and i have to take english and history and a whole ton of other crap that has nothing to do with anything... but anyways, thanks alot, i am going to implement this right now.
Sep 27 '07 #6
Plater
7,872 Expert 4TB
Ahhh....
Change the type of your combobox to be restricted to whats inside it.
It's one of the properties.

Expand|Select|Wrap|Line Numbers
  1. mycombobox.DropDownStyle = ComboBoxStyle.DropDownList;
  2. //does not allow text to be edited
  3.  
Sep 27 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Mr. B | last post by:
I've been seeking the solution to this. But can't figure it out (sounds simple enough). When you Populat a ComboBox, you can select the initial displayed items on startup simply by setting the...
6
by: Georges Heinesch | last post by:
An easy ComboBox question. ;) I would like to create a ComboBox, which permits to cycle through 3 subforms. These 3 subforms are entered in the ComboBox as Value List. The subforms should only...
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...
4
by: David Sworder | last post by:
Hi, I have a ComboBox that contains 1,400 sorted items . Here's the list: abba apple ... cabba caccaa capple
4
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
0
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
6
by: Sakharam Phapale | last post by:
Hi All, How to fill one ComboBox from other ComboBox control? 1) Only setting the reference does the trick but doesn't show items in control. If you see in immediate window, it shows...
6
by: Hal Heinrich | last post by:
How do I implement the value equivalent of the ComboBox.FindStringExact method? I.e. How do I set the ComboBox.SelectedIndex so that the ComboBox.SelectedValue object matches one that I specify....
4
by: JJGarcia | last post by:
Hi Everyone, I'll try to explain the process I'm following, I'm new to this so I'm triying the easy way first, probably the lasyest too! I created a new Project, drag in to it a SQLConnection,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.