Solved

Combo box List items become squares?

Posted on 2004-10-13
14
233 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
Comment Utility
There's the character!  Where the hell did they come from?  My paste attempts?  Now I'm confused.
0
 

Author Comment

by:cphansen
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 32

Expert Comment

by:Erick37
Comment Utility
Yes, but the characters in the question are 1's

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

Expert Comment

by:dbrckovi
Comment Utility
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
Comment Utility
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
Comment Utility
Definitely font problem: Try changing the .Font property of combo box
0
 
LVL 11

Expert Comment

by:dbrckovi
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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