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

Write a program in C# to implement Multiple Interfaces in a Single class.

Write a program in C# to implement Multiple Interfaces in a Single class.

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 c#-> console Application.

Program:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace readwrite
{
    class Program
    {
        static void Main(string[] args)
        {
            Interfaces d = new Interfaces();
            Interfaces1 d1 = new Interfaces();
            Interfaces2 d2 = new Interfaces();
            d1.show1();
            d2.show2();
        }
    }
    interface Interfaces1
    {
        void show1();
    }
    interface Interfaces2
    {
        void show2();
    }

    class Interfaces : Interfaces1, Interfaces2
    {
        public void show1()
        {
            Console.WriteLine("This is Interface1.");
            Console.ReadLine();
        }
        public void show2()
        {
            Console.WriteLine("This is Interface2 ");
            Console.ReadLine();
        }
    }
}

Demo:
Write a program in C# to implement Multiple Interfaces in a Single class.
Write a program in C# to implement Multiple Interfaces in a Single class.