Controlling properties at real-time in Visual Basic 2015

Asked By 30 points N/A Posted on -


I want know more other ways to controls in Visual Basic 2015. How can I control shapes in VB? Help me create a program that will display the shape that is equivalent or will correspond to button actions. What are the controls I need to use that must be included in the form? Can you show me the codes and explain it one by one? How useful this program in other aspects? Can you give me more ideas on how to manipulate shapes at runtime?

Please help me!

Thank you!

Answered By 0 points N/A #166346

Controlling properties at real-time in Visual Basic 2015


Hello Amanda!


This program is an easy task and I am sure that you can definitely do this without sweat. You just need a few controls to make this simple program work. Open your VB version.

1.  1 Form

2.  1 HScrollbar control

3.  2 shapes (I used oval and rectangle) = name property must be set to “OS1” and “RS1”. OS will be used by oval and RS will be used by rectangle.

Here’s how your code will look like.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll

        OS1.BorderWidth = HScrollBar1.Value

        RS1.BorderWidth = HScrollBar1.Value

    End Sub

End Class

Notice that both lines 5 and 6 the width of each shape is only set to become equal for the scroll bar value. Thus, moving the scroll bar from left to right it will change the border width of the shapes at the same time.


Login/Register to Answer

Related Questions