Hi, Im brand new to VB and almost completely new to scripting.
Where could I find a list of the most basic and useful commands with explanations, or even just like a dictionary of commands in VB?

Also, (this is a painfully easy question but searches haven't come up with any useful results) how do you make something happen if a button is clicked... Ill explain.

Ive made my first app - the picture viewer - and am currently expanding it. So far I have added a full-screen function with

Private Sub FullScreenButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FullScreenButton.Click

        Me.WindowState = 2 'maximized (2)
        Me.FormBorderStyle = 0 'none (0)
        FullScreenButton.Text = "Close Full Screen"
        FullScreenButton.Name = "CloseFSButton" 'Do I need this line?

    End Sub
End Class

Now how do I make it Close full screen when that button has been clicked?


Ive been playing around with it for a while but cant figure it out :(

Thanks!

Recommended Answers

All 2 Replies

I don't think that will work with only one button. Here ya go:

Public Class Form1

    Private Sub btnFullScreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFullScreen.Click
        Me.WindowState = FormWindowState.Maximized
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None

    End Sub

    Private Sub btnExitFS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExitFS.Click
        Me.WindowState = FormWindowState.Normal
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
    End Sub
End Class

EDIT:
One button code:

Public Class Form1

    Private FullScreen As Boolean = False

    Private Sub btnFullScreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFullScreen.Click
        If FullScreen = False Then
            Me.WindowState = FormWindowState.Maximized
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
            btnFullScreen.Text = "Exit Full Screen"
            FullScreen = True

        ElseIf FullScreen = True Then

            Me.WindowState = FormWindowState.Normal
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
            btnFullScreen.Text = "Enter Full Screen"
            FullScreen = False
        End If

    End Sub
End Class

See if this helps.

>>Where could I find a list of the most basic and useful commands with explanations, or even just like a dictionary of commands in VB?
MSDN and google

>>FullScreenButton.Name = "CloseFSButton" 'Do I need this line?
no you don't have

>>Now how do I make it Close full screen when that button has been clicked?
RenanLazarotto was give great example..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.