Pages

Saturday, 3 November 2012

Create a Position application in VB that changes the position of text in a label according to the command selected by the user. The application should include a Program menuwith an Exit command and a Position menu with TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, and BottomRight commands

Create a Position application in VB that changes the position of text in a label according to the command selected by the user. The application should include a Program menuwith an Exit command and a Position menu with TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, and BottomRight commands

Description:
In this post we are going to learn the use of dialog control. Include all the five dialog controls like OpenFileDialog,SaveFileDialog,FolderBrowserDialog,FontDialog,ColorDialog.

Open Microsoft visual studio
File-> New -> Project -> visual vb -> Windows Forms Application.

Program:

Design a window form as shown in figure in vb


Create a Position application in VB that changes the position of text in a label according to the command selected by the user. The application should include a Program menuwith an Exit command and a Position menu with TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, and BottomRight commands
Create a Position application in VB that changes the position of text in a label according to the command selected by the user. The application should include a Program menuwith an Exit command and a Position menu with TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, and BottomRight commands



Public Class Form1
    Private Sub TopCenterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TopCenterToolStripMenuItem.Click
        Label1.Location = New Point(0, 20)
    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub TopCenterToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TopCenterToolStripMenuItem1.Click
        Label1.Location = New Point(125, 20)
    End Sub

    Private Sub TopRightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TopRightToolStripMenuItem.Click
        Label1.Location = New Point(250, 20)
    End Sub

    Private Sub MiddleLeftToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MiddleLeftToolStripMenuItem.Click
        Label1.Location = New Point(0, 125)
    End Sub

    Private Sub MiddlCenterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MiddlCenterToolStripMenuItem.Click
        Label1.Location = New Point(125, 125)
    End Sub

    Private Sub MiddleRightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MiddleRightToolStripMenuItem.Click
        Label1.Location = New Point(250, 125)
    End Sub

    Private Sub BottomTopToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BottomTopToolStripMenuItem.Click
        Label1.Location = New Point(0, 250)
    End Sub

    Private Sub BottomCenterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BottomCenterToolStripMenuItem.Click
        Label1.Location = New Point(125, 250)
    End Sub

    Private Sub BottomRightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BottomRightToolStripMenuItem.Click
        Label1.Location = New Point(250, 250)
    End Sub
End Class

Demo:

Create a Position application in VB that changes the position of text in a label according to the command selected by the user. The application should include a Program menuwith an Exit command and a Position menu with TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, and BottomRight commands

No comments:

Post a Comment