Solved

Combo box List items become squares?

Posted on 2004-10-13
14
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

623 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