Why is the selectedtext in the combobox aligned the to the right where every other item is aligned to the left.

Following is a code snippet

cboSystemStatus.DataSource = objRPlayer.GetSystemStatusDescriptions();   // <- Datatable prepopulated from stored procedure
cboSystemStatus.ValueMember = "systemStatusID".ToString().Trim();
cboSystemStatus.DisplayMember = "SystemStatusDescription".ToString().Trim();
//cboSystemStatus.SelectedValue = objRPlayer.SystemStatusID;


Now every thing appears perfectly when i drop down my combobox.   All Display members appear perfectly.   No problem there....


When i select an item in the combobox.  The selected displaymember appears to be cut off by the first few characters.  As if the trim function is not being preformed correctly and being aligned from the right hand side.

I'm a bit of a newbie with windows forms.  Can somebody tell my why only the selected text is out of place?????

Thanks in Advance



camdempsterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vinhnlCommented:
Hi camdempster,

cboSystemStatus.DisplayMember = "SystemStatusDescription".ToString().Trim();
this line isn't trim because "SystemStatusDescription".ToString().Trim() = "SystemStatusDescription".

Don't trim your field name :) Please trim values of records in your table.

see this sample:

tableset ts = objRPlayer.GetSystemStatusDescriptions();

for (int i=0;i<ts.rows.count;i++)
     ts.rows[i]["SystemStatusDescription"] = ts.rows[i]["SystemStatusDescription"].tostring().trim();

Good luck,
VINHNL
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
camdempsterAuthor Commented:
Bang on VINHNL,



Thanks dude, worked perfectly.  Is there not an easier way of doing it though?  I just thought I could trim the column rather than traverse through and trim each cell?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.