Creating a simple program in Visual Basic 2015

Asked By 20 points N/A Posted on -
qa-featured

Hello!

I want to create a program in VB2015 or 6.0 that will change the size of the form by clicking command buttons. What are the controls need for this program? Can you provide me step-by-step? Can you explain to me the declarations that you use if possible line-by-line? Can you show me on how to change properties in run time? Can you show me also how to create .exe and how to save it and run it? Is it true that we can create installer out of VB 2015 or VB 6.0? Please help me teach my self VB. Thank you!

SHARE
Answered By 0 points N/A #172430

Creating a simple program in Visual Basic 2015

qa-featured

Hello Debra!

It is easy to achieve your goal. So don’t worry I will show you how easily this can be done.

We just need the following.

1.  1 Form

2.  3 Command Buttons

The sample output window is illustrated below:

Here are the codes:

Public Class Form1

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

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Me.Size = New System.Drawing.Size(1200, 1200)

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Me.Size = New System.Drawing.Size(600, 600)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Me.Size = New System.Drawing.Size(300, 300)

    End Sub

End Class

Explanations: Lines 5, 8, 11 “Me.Size = New System.Drawing.Size(w,h)”. We used “Me” as the proper form in VB. Me pertains to Form1. The equivalent size will be determined by setting the w and height values.

Login/Register to Answer

Related Questions