Guest_imported
New member
- Jan 1, 1970
- 0
I have a vert. scroll bar on a form using the below code. V scroller worked great until I added a common dialog box. Problem: When I run my exe and try using the vert. scroll. I rec' the following error message " 'Top' property cannot be read at run time." debug hi lites the follow code: "ctl.Top = ctl.Top + VPos - VScroll1.Value"
Without the dlg the vscroller works fine. Without vscroll the dlg works fine. Any help would be greatly appreciated.
vscroll code:
Dim VPos As Integer
Private Sub VScroll1_Change()
Call ScrollForm(0)
End Sub
Private Sub VScroll1_Scroll()
Call ScrollForm(0)
End Sub
Public Sub ScrollForm(Direction As Byte)
Dim ctl As Control
'Scroll Vertically
If Direction = 0 Then
For Each ctl In Me.Controls
'Make sure it's not a ScrollBar
If Not (TypeOf ctl Is VScrollBar) Then
'If it's a Line then
If TypeOf ctl Is Line Then
ctl.Y1 = ctl.Y1 + VPos - VScroll1.Value
ctl.Y2 = ctl.Y2 + VPos - VScroll1.Value
Else
ctl.Top = ctl.Top + VPos - VScroll1.Value
End If
End If
Next
VPos = VScroll1.Value
End If
End Sub
Without the dlg the vscroller works fine. Without vscroll the dlg works fine. Any help would be greatly appreciated.
vscroll code:
Dim VPos As Integer
Private Sub VScroll1_Change()
Call ScrollForm(0)
End Sub
Private Sub VScroll1_Scroll()
Call ScrollForm(0)
End Sub
Public Sub ScrollForm(Direction As Byte)
Dim ctl As Control
'Scroll Vertically
If Direction = 0 Then
For Each ctl In Me.Controls
'Make sure it's not a ScrollBar
If Not (TypeOf ctl Is VScrollBar) Then
'If it's a Line then
If TypeOf ctl Is Line Then
ctl.Y1 = ctl.Y1 + VPos - VScroll1.Value
ctl.Y2 = ctl.Y2 + VPos - VScroll1.Value
Else
ctl.Top = ctl.Top + VPos - VScroll1.Value
End If
End If
Next
VPos = VScroll1.Value
End If
End Sub