Solved

ComboBox selected text position changes after selected item change

Posted on 2011-09-30
4
474 Views
Last Modified: 2012-05-12
Hello,

I am using Windows Forms. I have a problem with ComboBox, selected text. My problem was, that text of some items was longer than the combo box -> I've solved this with properties:

myCombo.SelectionStart = 0
myCombo.SelectionLength = 0

That works OK for the first item. Of course, I don't see whole text, but at least I see text of the item from the start, which is good enough. But, if I select some other item from the combo box and it's text is longer than the combo I see only the end of the text -> but I must see text from the start.

I've also tried to catch SelectedIndexChanged event and re-set properties, without success:

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox3.SelectionStart = 0;
            comboBox3.SelectionLength = 0;
        }


Any idea?


Greetins, Frenky
0
Comment
Question by:AntonioRodrigo
4 Comments
 
LVL 6

Accepted Solution

by:
kswathi earned 167 total points
ID: 36890791
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 167 total points
ID: 36891137
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 166 total points
ID: 36892522
Depending on the data you use and what you do with it, you could also modify the text in the source with a Substring command so that it is not too long.
0
 

Author Comment

by:AntonioRodrigo
ID: 36901946
Thanks for answers.

I've managed to solve the problem, but not 100%. I put

comboBox.SelectionStart = 0;
comboBox.selectionLength = 0;

on key up and mouse over events. Default behaviour on selected item changed occurs every time - whole item is selected and you see only the end of it. WIth those two events, the selection is moved back to the start. Default behaviour cannot be overriden, but you can have affect on it after it happens.

0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where does legacy ASP.NET initialize language? 2 63
reading excel file in .net 2 32
Adding where clause to entity statement c# 1 48
Stop Git from being my repository 1 26
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question