Question : vb6 scrollbar overflow error

I am making modifications to another developer's project that has a form with a scrollbar.  I don't really get the jist of the cde, but on the form resize event, I am getting an overflow error on this line:
                 .Max = iFullFormHeigth - Me.Height

The value of (iFullFormHeigth - Me.Height) is 63435 at this point.

        With VScroll1
            .Height = Me.ScaleHeight - HScroll1.Height
            .Min = 0
            'MsgBox iFullFormHeigth - Me.Height
            .Max = iFullFormHeigth - Me.Height
            .SmallChange = Screen.TwipsPerPixelY * 10
            .LargeChange = Me.ScaleHeight - HScroll1.Height
        End With
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
Dim iFullFormHeigth As Long 'integer
Dim iFullFormWidth As Long 'integer

Private Sub Form_Resize()

VScroll1.Left = Me.Width - (1.45 * VScroll1.Width)
HScroll1.Top = Me.Height - (2.45 * HScroll1.Height)

Picture1.Left = VScroll1.Left
Picture1.Top = HScroll1.Top

'If the full screen is already showing,
'then disable the scrollbar
VScroll1.Enabled = (iFullFormHeigth - Me.Height) >= 0

'First, make sure we aren't minimized
If Me.ScaleHeight > HScroll1.Height And Me.Width > VScroll1.Width Then
    
    'If there is any more screen to see,
    'modify the scrollbar
    If VScroll1.Enabled Then
        With VScroll1
            .Height = Me.ScaleHeight - HScroll1.Height
            .Min = 0
            .Max = iFullFormHeigth - Me.Height
            .SmallChange = Screen.TwipsPerPixelY * 10
            .LargeChange = Me.ScaleHeight - HScroll1.Height
        End With

    'Otherwise, just resize the scrollbar for neatness
    Else: VScroll1.Height = Me.ScaleHeight - HScroll1.Height
    End If

    HScroll1.Enabled = (iFullFormWidth - Me.Width) >= 0
    If HScroll1.Enabled Then
        With HScroll1
            .Width = Me.ScaleWidth - VScroll1.Width
            .Min = 0
            .Max = iFullFormWidth - Me.Width
            .SmallChange = Screen.TwipsPerPixelX * 10
            .LargeChange = Me.ScaleWidth - VScroll1.Width
        End With

    Else: HScroll1.Width = Me.ScaleWidth - VScroll1.Width
    End If
End If
End Sub

Answer : vb6 scrollbar overflow error

dim myvar as integer

if  iFullFormHeigth - Me.Height > 32767 then
myvar = 32767
else
myvar =  iFullFormHeigth - Me.Heigh
end if

'MsgBox iFullFormHeigth - Me.Height
 .Max = myvar
Random Solutions  
 
programming4us programming4us