473,804 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox SelectionStart Enter Event Question

Hello

I've created a .NET 2.0 form and added 6 text boxes, 1 combo box and 2
button controls.

The combo box has a DropDownStyle of DropDown, so the user can still type in
the combo box.

The combo box has the follows values in it's drop down list:
"Dear Sir,"
"Dear Madam,"

I want the text between "Dear " and "," to be highlighted when the combo box
gets focus.

I've tried adding code into the ComboBox Enter event to try and force it to
select just the text between "Dear " and "," using the SelectionStart and
SelectionLength properties, but it keeps selecting all the text.

How can I just select the text between "Dear " and "," in my ComboBox?

Thank you for your help.
Jan 29 '08 #1
1 5209
Mark,

Well, could you post a complete example which details the problem? We
could make guesses as to what you are doing, but we might not be anywhere
close.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mark" <Ma**@discussio ns.microsoft.co mwrote in message
news:BF******** *************** ***********@mic rosoft.com...
Hello

I've created a .NET 2.0 form and added 6 text boxes, 1 combo box and 2
button controls.

The combo box has a DropDownStyle of DropDown, so the user can still type
in
the combo box.

The combo box has the follows values in it's drop down list:
"Dear Sir,"
"Dear Madam,"

I want the text between "Dear " and "," to be highlighted when the combo
box
gets focus.

I've tried adding code into the ComboBox Enter event to try and force it
to
select just the text between "Dear " and "," using the SelectionStart and
SelectionLength properties, but it keeps selecting all the text.

How can I just select the text between "Dear " and "," in my ComboBox?

Thank you for your help.

Jan 29 '08 #2

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

Similar topics

13
2800
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
0
1004
by: Michael Shapiro~ | last post by:
For all of you who are searching for auto complete functionality in ..net combobox. I wrote this code yesterday after being unable to find something usable and workable on the internet. All examples that I've tried either bulky and simply not elegant and inefficient or does not work properly. Maybe I was just not lucky and patient enough to try more examples :) instead I wrote my own code. Hope it helps someone. I appreciate all comments...
2
4532
by: ross kerr | last post by:
Hi all, I have a control that extends the ComboBox object. It updates the selected item based on what the user enters in the text area. In the OnLeave event of the combobox, the selected index is set to the proper item. However, when accessing its selectedindex later it has reverted to the previous value. The selectedindex value is always one behind what
0
1013
by: Segfahlt | last post by:
I have an inherited comboBox that I'm using to try to make an intellisense type box in VS 2003 .Net. It works okay in VS.Net 2002. I can get it to do most of my stuff, but it's not keeping the SelectionStart and SelectionLength values I assign in my OnKeyPress event. Here is a snippet of my code. The Application.DoEvents() funcs are just so I can see what's going on at various spots. private void OnKeyPress(object sender,...
5
4146
by: Andy | last post by:
I am having trouble using the ComboBox in my app. I am attempting to use the text from the ComboBox, to search the list box portion. However: In my "TextChanged" event: I cannot get the value of the entered text. Below is my code. private void cbEdit_TextChanged(object sender, System.EventArgs e) { bool bFound = false; string sText = cbEdit.Text; int iPosition = cbEdit.SelectionStart;
5
2155
by: ross kerr | last post by:
Hi All, I am extending the combobox to create a control that selects an item based on the text the user is typing into the text area of the control. I have an issue that occurs only when i drop down the combo box as the users typing. When the on leave event is fired the value in the selected
19
18358
by: Bernie Yaeger | last post by:
Everyone misses the point on this - what we need is a combobox autocomplete that is a dropdownlist only. When in dropdown mode, you can enter text - making that autocomplete is trivial. But when you look at combobox controls from years ago, they would autocomplete in dropdownlist mode. And if you look at intellisense, this is exactly what happens, so obviously the .net framework can do it. Any help would be much appreciated. Bernie...
2
2226
by: Kalvin | last post by:
I found some code in Google, don't remember where, for an AutoComplete combobox. Everything is great with it except for one thing. If I use the mouse to drop the list down, then start typing to find the item in the list, the visible text changes, but the values of me.Text and Mybase.Text do not change. If you use the mouse and actually click on the item, the values of me.text and Mybase.Text will change. Or, if you use the enter key to...
0
2062
by: Randy | last post by:
Hi, I have some comboboxes that are created dynamically at run time based on user actions. I found a procedure on a message board to autofill the combobox text from the dataview that the comboboxes are bound to. It works perfectly on the comboboxes that I have created at design time, but the ones that I create runtime behave differently. The problem is that when the user tabs onto the combobox, the box stays blank, which is fine. ...
0
9711
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.