472,146 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Changing label font size in visual basic 6.0

Create a font size increment application that displays Size in label and increases the font size of the label in intervals of 5 starting at size 10 and ending at size 50.

Here is my code:
Dim intCount As Integer, intStart As Integer, intEnd As Integer
Dim intStep As Integer
Dim intSize As Integer

intStart = lblSize.Font.Size = 10
intEnd = lblSize.Font.Size = 50
intStep = lblSize.Font.Size = 5

For intCount = intStart To intEnd Step intStep
intSize = intSize + intCount
Next intCount

lblSize.Font.Size = intCount

However, when I run this applicaton my computer freezes and ends up crashing...how can i fix this? Thanks!
Dec 17 '11 #1
1 8609
8,435 Expert 8TB
I'd suggest you use VB's excellent debugging tools to interrupt this code as soon as it starts, and examine the values that you're placing in each variable.

In my opinion, what you're actually placing in intStart, intEnd and intStep is either True (-1) or False (0). If we take this statement for example...
Expand|Select|Wrap|Line Numbers
  1. intStart = lblSize.Font.Size = 10
what you're assigning to intStart is the result of the comparison operation lblSize.Font.Size = 10. This will be either True or False, depending on whether the font size is 10.
Dec 18 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by andrew.ames | last post: by
2 posts views Thread by Peter Oliphant | last post: by
6 posts views Thread by Miro | last post: by
reply views Thread by Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.