Text Align not working on One Combo Box (1 Viewer)

TheSearcher

Registered User.
Local time
Today, 12:47
Joined
Jul 21, 2011
Messages
342
I have 10 combo boxes on a form. All of them are set to text align = center in the properties box.
One of them always loads as left justifed. This only happens on load. If I choose another option in the same combo box the alignment is center as it should be. But on load it becomes left justified again. This only happens with one of the 10 combo boxes.
Any ideas?
 
Have you inspected code running in the form's open or load events, or in the combo itself?
 
I have 10 combo boxes on a form. All of them are set to text align = center in the properties box.
One of them always loads as left justifed. This only happens on load. If I choose another option in the same combo box the alignment is center as it should be. But on load it becomes left justified again. This only happens with one of the 10 combo boxes.
Any ideas?
Also, when the combo box is first displayed, does it already have items selected?

Does the combo box drop down when it gets focus?

How many columns are displayed?
 
Hi GPGeorge,
Thanks for responding.
Assuming that the user chose an option originally (which in this case I did) then yes, there would be data when the box is first displayed. There is also data in the other combo boxes as well but there are no problems with them.
There is no code in either the open or load events that would affect text alignment.
The combo doesn't drop down when it gets focus. You need to click on it for it to drop down.
There is one column displayed.
 
1719943993654.png
 
Yes the properties are identical. As a matter of fact they are copies of each other. They just have different names.
 
That's interesting. How about the design view of the form. Are the various properties of all of the combo boxes identical? The behavior displayed in your screenshot is what I see when there are two or more visible columns and the dropdown is open.
That leaves the data to be considered.
 
The data are values in a value list. I just copied this value list from another combo box since they all contain the same values. Problem still exists. I then deleted the entire combo box and recreated it. Problem still exists. This is most definitely an interesting problem.
 
The data are values in a value list. I just copied this value list from another combo box since they all contain the same values. Problem still exists. I then deleted the entire combo box and recreated it. Problem still exists. This is most definitely an interesting problem.
A value list. Maybe instead of copy/paste, it would be worthwhile typing in the values manually.
 
I found the problem. The data, once entered, is stored in an SqlServer table. Each of the fields in this table has a char(1) datatype - except the field with the problem. That field had a char(10) datatype. I changed it to char(1) and now the problem is solved. I appreciate your time GPGeorge. This explains why it was centered when first entered but left justified when the form opened and got its data from the SqlServer table. And - you did say "That leaves the data to be considered." Thanks again!
 
The data are values in a value list. I just copied this value list from another combo box since they all contain the same values. Problem still exists. I then deleted the entire combo box and recreated it. Problem still exists. This is most definitely an interesting problem.
To test if it might be a data problem, you could assign the number "3" instead of copying the value from another combobox to see it it works or not.
[edit]
Too late! I see the problem is solved!
 
I found the problem. The data, once entered, is stored in an SqlServer table. Each of the fields in this table has a char(1) datatype - except the field with the problem. That field had a char(10) datatype. I changed it to char(1) and now the problem is solved. I appreciate your time GPGeorge. This explains why it was centered when first entered but left justified when the form opened and got its data from the SqlServer table. And - you did say "That leaves the data to be considered." Thanks again!
And to add to the difficulty in SQL Server, Char(10) means exactly 10 characters and spaces. NChar(10) means one or more characters up to a maximum of 10.
 

Users who are viewing this thread

Back
Top Bottom