Solved

Combo box List items become squares?

Posted on 2004-10-13
14
235 Views
Last Modified: 2010-05-02
I have a dropdown combo box, populated by these values in the List property of the control:

-2
-1
0
+1
+2

When I remove -2 and -1, then re-examine the list contents, the 0 becomes an empty square character.  In fact, any other entry that I change becomes one of these characters.  I can't seem to cut-and-paste it here, but you've likely seen the character I'm referring to.  

What gives?
0
Comment
Question by:cphansen
  • 6
  • 4
  • 2
  • +1
14 Comments
 

Author Comment

by:cphansen
ID: 12305191
There's the character!  Where the hell did they come from?  My paste attempts?  Now I'm confused.
0
 

Author Comment

by:cphansen
ID: 12305200
Wow, it would appear my computer is at fault here.  I'm getting all kinds of anomalies when typing this reply.  I've rebooted to no effect for the problem in question.  Could it be my Windows install?
0
 
LVL 11

Accepted Solution

by:
dbrckovi earned 75 total points
ID: 12305433
Hi!

Can you answer this?

 - create a combobox, and paste this code:
'----------------------------------------------------
Private Sub Form_Load()
    Dim Item As String
   
    Combo1.Clear
    For x = -2 To 2
        Combo1.AddItem x
    Next x

    Me.Show

    For x = 0 To Combo1.ListCount - 1
        Item = Combo1.List(x)
        For Char = 1 To Len(Item)
            Print Asc(Mid(Item, Char, 1))
        Next Char
    Next x
End Sub
'-----------------------------------------------------------

When you run it, what do you get?
You should get these results on the left side of your form:
45  -
50  2
45  -
49  1
48  0
49  1
50  2


Are you getting the same results?
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12305439
If you remove first two items like this:

'--------------------------------------------
Private Sub Form_Load()
    Dim Item As String
   
    Combo1.Clear
    For x = -2 To 2
        Combo1.AddItem x
    Next x

    Combo1.RemoveItem 0
    Combo1.RemoveItem 0

    Me.Show

    For x = 0 To Combo1.ListCount - 1
        Item = Combo1.List(x)
        For Char = 1 To Len(Item)
            Print Asc(Mid(Item, Char, 1)) & "   " & Mid(Item, Char, 1)
        Next Char
    Next x
End Sub
'---------------------------------------------
you should get:

48  0
49  1
50  2
0
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 50 total points
ID: 12308089
Sounds like you have a hardware issue since the problem happened in your first post as well.  Perhaps when you cut and paste.

Those characters are:

debug.print Asc("") = 1
 
    and

Const vbKeyLButton = 1

Maybe your mouse and / or keyboard need a vacation.  Can you swap out the keyboard/mouse to eliminate that as the cause?
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12308572
Actualy almost all ascii codes from 0 to 31 are represented as "", or something similar depending on the font.

For example: None of these squares have the same ascii code. (Or atleast they shouldn't if they are saved as I posted them)

      


0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 32

Expert Comment

by:Erick37
ID: 12308616
Yes, but the characters in the question are 1's

"What gives?" <---- all 1's
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12316358
You're right.
I just wanted to state that there are more ascii codes which are represented with a square.
I didn't mean to oppose to your comment, but to expand it.
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12316413
Anyway.

I'd like to suggest few more things that might help:

 - Maybe your font's are scrambled in some way. Try reinstalling them or using different fonts.
 - If your keyboead leayout is not set to English, try setting it to Englsih, or try setting all regional settings to your language/country
 - Try running a virus scan. Maybe you picked up some virus which scrambles your characters. http://housecall.antivirus.com/
 - Maybe it's hardware problem. Try swapping your keyboard as Erick37 suggested, or if you don't have another keyboard available try using On Screen Keyboard program:        Start -> Run -> type:  "osk"
            If the problem is solved using osk, then buy new keyboard.
 - If you have them available, try using different type of keyboard (USB, PS2)

 - If nothing else helpes, then first try to repair your Windows installation
 - If this won't help either, do a fresh reinstall
0
 
LVL 4

Expert Comment

by:AjithJose
ID: 12329158
Definitely font problem: Try changing the .Font property of combo box
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12563221
We can't know if some answer was correct becouse, after asking the qustion, author didn't respond.
We don't even know if it's hardware or software problem, but I'm sure Erick37's and my suggestions would solve it, so I suggest a split.
0
 

Author Comment

by:cphansen
ID: 12564671
My apologies.  I don't usually leave questions hanging.  I shelved this problem for a little while, as the problem is not a large concern, and more pressing matters have taken me away from this one.

I will get back to this today.

Craig
0
 

Author Comment

by:cphansen
ID: 12564747
Took another look at it.  The problem is gone.  The install is the same.  The keyboard is the same.  No fonts were changed.  No virus was found. I use NOD32, scan weekly, and have been since before this problem was posted.

I'm at a loss as to why, but at least it works.

I'll split the points across the board.  I guess this was just a weird one.

Craig

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vba find the last empty column 10 88
Adding to a VBA? 6 60
Access 2013 combo box not working 3 38
MsgBox 4 43
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

932 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now