Solved

vscroll in reverse.

Posted on 2004-10-12
5
362 Views
Last Modified: 2008-01-09
The vscrolls scrolling in reverse, can someone help me figure out a way to make it scroll normally uparrow makes a number go up,  downarrow makes the number go down.  i been trying to figure a way around this without using that other control updown in ms common controls 2 6.0 sp4.
0
Comment
Question by:andyakira
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 12294605
Can we have your code in the vscroll control's Change event? I think you just simply write something wrong there...
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 350 total points
ID: 12294938
You just need to subtract the current value of VScroll1 from the Max value like this:

Private Sub Form_Load()
    VScroll1.Min = 0
    VScroll1.Max = 100
    VScroll1_Change
End Sub

Private Sub VScroll1_Change()
    Label1.Caption = VScroll1.Max - VScroll1.Value
End Sub
0
 
LVL 11

Accepted Solution

by:
dbrckovi earned 150 total points
ID: 12295350
OK. You have assigned large points, so I'm going to give you a large answer.

If you already have a project with vertical scroll bars, and would like to change their direction, you can subtract Value from Max, but this means you have to
change every line in your code where you referenced Value property.

Alternative is to create your own ActiveX control which will behave just like VScrollBar but in reversed direction, and replace your old VScrollBar with it.
Here's how to do it:

 - start New ActiveX Control  project
 - change project's name to RVSB                          (Reversed Vertical Scroll Bar)
 - change control's name to VScrollReversed
 - create vertical scroll bar control and leave its original name (VScroll1)
 - press F7 and
 - paste this code:
'------------------------------------------------------------
Public Event Change()
Public Event KeyDown(KeyCode As Integer, Shift As Integer)
Public Event KeyPress(KeyAscii As Integer)
Public Event KeyUp(KeyCode As Integer, Shift As Integer)
Public Event Scroll()

Private Sub UserControl_Initialize()
    VScroll1.Top = 0
    VScroll1.Left = 0
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    VScroll1.Max = PropBag.ReadProperty("Max")
    VScroll1.Enabled = PropBag.ReadProperty("Enabled")
    VScroll1.LargeChange = PropBag.ReadProperty("LargeChange")
    VScroll1.Min = PropBag.ReadProperty("Min")
    VScroll1.MouseIcon = PropBag.ReadProperty("MouseIcon")
    VScroll1.MousePointer = PropBag.ReadProperty("MousePointer")
    VScroll1.RightToLeft = PropBag.ReadProperty("RightToLeft")
    VScroll1.SmallChange = PropBag.ReadProperty("SmallChange")
    VScroll1.Value = PropBag.ReadProperty("Value")
End Sub

Private Sub UserControl_Resize()
    VScroll1.Width = UserControl.Width
    VScroll1.Height = UserControl.Height
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    PropBag.WriteProperty "Max", VScroll1.Max
    PropBag.WriteProperty "Enabled", VScroll1.Enabled
    PropBag.WriteProperty "LargeChange", VScroll1.LargeChange
    PropBag.WriteProperty "Min", VScroll1.Min
    PropBag.WriteProperty "MouseIcon", VScroll1.MouseIcon
    PropBag.WriteProperty "MousePointer", VScroll1.MousePointer
    PropBag.WriteProperty "RightToLeft", VScroll1.RightToLeft
    PropBag.WriteProperty "SmallChange", VScroll1.SmallChange
    PropBag.WriteProperty "Value", VScroll1.Value
End Sub



Private Sub VScroll1_Change()
    RaiseEvent Change
End Sub

Private Sub VScroll1_KeyDown(KeyCode As Integer, Shift As Integer)
    RaiseEvent KeyDown(KeyCode, Shift)
End Sub

Private Sub VScroll1_KeyPress(KeyAscii As Integer)
    RaiseEvent KeyPress(KeyAscii)
End Sub

Private Sub VScroll1_KeyUp(KeyCode As Integer, Shift As Integer)
    RaiseEvent KeyUp(KeyCode, Shift)
End Sub

Private Sub VScroll1_Scroll()
    RaiseEvent Scroll
End Sub

Public Property Get Enabled() As Boolean
    Enabled = VScroll1.Enabled
End Property

Public Property Let Enabled(ByVal vNewValue As Boolean)
    VScroll1.Enabled = vNewValue
End Property

Public Property Get LargeChange() As Integer
    LargeChange = VScroll1.LargeChange
End Property

Public Property Let LargeChange(ByVal vNewValue As Integer)
    VScroll1.LargeChange = vNewValue
End Property

Public Property Get Max() As Integer
    Max = VScroll1.Max
End Property

Public Property Let Max(ByVal vNewValue As Integer)
    VScroll1.Max = vNewValue
End Property

Public Property Get Min() As Integer
    Min = VScroll1.Min
End Property

Public Property Let Min(ByVal vNewValue As Integer)
    VScroll1.Min = vNewValue
End Property

Public Property Get MouseIcon() As StdPicture
    Set MouseIcon = VScroll1.MouseIcon
End Property

Public Property Set MouseIcon(ByVal vNewValue As StdPicture)
    Set VScroll1.MouseIcon = vNewValue
End Property

Public Property Get MousePointer() As Integer
    MousePointer = VScroll1.MousePointer
End Property

Public Property Let MousePointer(ByVal vNewValue As Integer)
    VScroll1.MousePointer = vNewValue
End Property

Public Property Get RightToLeft() As Boolean
    RightToLeft = VScroll1.RightToLeft
End Property

Public Property Let RightToLeft(ByVal vNewValue As Boolean)
    VScroll1.RightToLeft = vNewValue
End Property

Public Property Get SmallChange() As Integer
    SmallChange = VScroll1.SmallChange
End Property

Public Property Let SmallChange(ByVal vNewValue As Integer)
    VScroll1.SmallChange = vNewValue
End Property

Public Property Get Value() As Integer
    Value = VScroll1.Max - VScroll1.Value
End Property

Public Property Let Value(ByVal vNewValue As Integer)
    VScroll1.Value = VScroll1.Max - vNewValue
End Property
'----------------------------------------------------------------

 - compile this to RVSB.OCX
 - Register this new control:          Start->Run, Type:    Regsvr32 C:\Temp\RVSB.OCX

How to use it:
 - Start new Standard EXE
 - Project->Components, find RVSB and enable it
 - Now you should be able to use it same as VScroll, but with reversed direction
0
 

Author Comment

by:andyakira
ID: 12303183
i split points, idlemind(350) and rckovi(150) because both were great solutions, idle minds solution was must faster and thats what im using right now, thanks guys.
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 12305372
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

623 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