vb6 app and IDE locks up on Vista and 7 when font changes

I have several applications that run just fine.
One in particular show my clients a schedule and allows them to change the fonts.
I give them several to choose from ( rather than choosing from their standards )
When I set the objects on the form to Comic Sans MS 10 it locks up even in the IDE.
This occurs at no specific point.  I even put a break at the form activate and it does stop there but the IDE is locked up and I can not even F8 to the next line of code.

This is not a problem for any other size of that font ranging from 7 to 14.
I have not tried other fonts to see if they could lock up also as of yet.
( yes in the lines of it hurts when I do that - just don't do that - I do not want to remove the ability to change the font to this.  I want to understand what would cause the IDE and the EXE to lock up because of a font change )
LVL 14
Brook BraswellApplication Development ManagerAsked:
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.

x77Commented:
Some time ago, I can see an error like this on a code sample.

The code sample has a User Control with bad code initialization.
Then Ide Hangs (also at design time when I change some properties).

Note that on Vb6, a font name mistake result on a Vb6 error.
Gdi Font API do´nt cause error as it replaces the FontFamily with other.
0
Brook BraswellApplication Development ManagerAuthor Commented:
the font name is fine but the size is causing an error
I am merely setting an objects
font.name = "Comic Sans MS"
font.Size = 10

Locks up when running
0
HooKooDooKuCommented:
Have you tried creating a new StdFont object, setting its properties, then setting the whole font in one stroke?

Dim F as new StdFont
  F.Bold = True
  F.Name = "Comic Sans MS"
  F.Size = 10

  Set Font = F


Otherwise, I see that you are showing code (claimed to be inside a form) that simply reads
font.name = "Comic Sans MS"

But that would be the same as
Me.Font.Name = "Comic Sans MS"
which would seem to only change the font for the form, not the font for all the controls on the form.

If I'm right, then what you really want to be doing is something like
Command1.Font.Name = "Comic Sans MS"
Text1.Font.Name = "Comic Sans MS"
etc

And if you are setting the fond for each control, I definitely would suggest that you set all the properties of a new StdFont object, and then set every objects Font to the new font:
Set Command1.Font = F
Set Text1.Font = F
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Brook BraswellApplication Development ManagerAuthor Commented:
I tried your suggestion HooKooDooKu and so far it still locks up.  
There are only 4 objects I am changing and 3 of them are Grids ( Janus Grid )
it seems to lock up there.  Hoping this is not a problem with my control.

I will let you know more tomorrow.

Thanks,
0
Brook BraswellApplication Development ManagerAuthor Commented:
ok !  This morning I replaced all I had to do with fonts and use the StdFont instead.
Now when setting my Grids I use
dim SFnt as new StdFont
SFnt.Name = "Comic Sans MS"
SFnt.Bold = True
SFnt.Size = 10 ' really sets the font to 9.75.  I have tried using both 9.75 and 10 and get same result.
dgMyGrid.Font = SFnt

all of this is done in the FormLoad event
I put a break at the end of the FormLoad and at the beginning of the FormActivate
By stepping through - it locks up the IDE at the Form_Activate
I must end Task VB6 to start over

I will try putting this code in the activate rather than the load to see if that makes a difference
0
HooKooDooKuCommented:
Is the problem ONLY with "Comic Sans MS" at a 10pt (9.75pt) size?  Do larger sizes or smaller sizes work?

From what you have described so far, my first though is that something is wrong inside the grid control... that basically if you set the font "wrong" that the control is what is really blowing up.  So assuming the control isn't just simply randomly blowing up, I would think it would be a predictable pattern... say a font that was too big in some way.  If I was correct, then something like 6pt Comic Sans MS would work, while 12pt Comic Sans MS would fail just as easily as your 10pt (9.75pt) does.

BTW, the way Windows works is that it takes all the properties you've entered for a font (name, size, bold, and a host of others) and uses some complex scoring scheme.  It then finds what actual installed font is the best match.  That would be a possible reason for your 10pt font to keep coming back as 9.75.  If this Comic Sans MS font isn't a true-type font and only has limited number of fixed sizes within it, that would be the reason your REQUEST for a 10pt font resulted in a 9.75pt font.
0
Brook BraswellApplication Development ManagerAuthor Commented:
It only seems to "break" on Comic Sans MS size 10 (9.75).
I can go up to 12 or down to 8 or up to 14 and down to 6 and it would work fine.

I change the line above from
dgMyGrid.Font = SFnt
to
Set dgMyGrid.Font = SFnt
and at this time it is not breaking on my Vista box !!

Going to Test on Windows 7 and Window 2008 r2
0
Brook BraswellApplication Development ManagerAuthor Commented:
It now works fine with Vista, 7 and 2008 R2.
Funny how it was only when Comic Sans.
Did some research and found that Comic Bob ( origination of the font )
has caused many problems with other systems and applications.
Regardless - Set obj.Font = F is the Key
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
Windows Vista

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.