Create a Program to Show Visual Basic Message Box

with No Comments

Today we will discuss on how to show Visual Basic Message Box. To more about this follow these steps which are showing below.

Visual Basic Message Box Program



Step 1: –

  • At first open Visual Basic 6.0 application software
  • Then click on or select ‘Standard EXE’ icon from New Project dialog box
  • Then click on ‘Open’.

Step 2: –

Form Design: –

Select necessary Control Tool from Tool Box and adjust the position to ‘Form Window’: –

  • Three Label Box
  • Three Text Box
  • Three Command Box

message box project

Step 3: –



Properties Settings: –

  • Select ‘Form1’from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Form1’ to ‘Message Box Project’ from properties window
  • Then select ‘Label 1 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label 1’ to ‘NAME’ from Properties Window.
  • Then select ‘Label 2 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label 2’ to ‘ITEM’ from Properties Window.
  • Then select ‘Label 3 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label 3’ to ‘VALUE’ from Properties Window.
  • Then select ‘Text1 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text1’ from Properties Window
  • Then select ‘Text2 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text2’ from Properties Window
  • Then select ‘Text3 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text3’ from Properties Window
  • Then select ‘Command1 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command1’ to ‘MESSAGE’ from Properties Window.
  • Then select ‘Command 2 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command 2’ to ‘CLEAR’ from Properties Window.
  • Then select ‘Command 3 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command 3’ to ‘EXIT’ from Properties Window.

message box project in visual basic
message-box-project

message-box-project

Visual Basic Message Box

Step 4: –

Code writing:-

  • Double click on ‘MESSAGE button’ or ‘Command 1 box’
  • Then input code to Command 1 code box

Code: – If Text3.Text>=50000 Then

             Msgbox “Mobile”

    Elseif Text3.Text>=20000 Then

             Msgbox “Cycle”

             Else

             Msgbox “Clock”

             End If

  • Then double click on ‘CLEAR button’ or ‘Command 4 box’
  • Then input code to Command 4 code box.

Code: – Text1.Text = “”

             Text2.Text = “”

             Text3.Text = “”

  • Then double click on ‘EXIT button’ or ‘Command 5 box’
  • Then input code to Command 5 code box.

Code: – End

message-box-project

  • Then close code box

Step 5: –

Project Save: –

  • Click on ‘Save project’ option from File menu
  • Then input any name to file name box and click on Save option from Save file as box
  • Then input any new name to file name box
  • Then click ‘Save’ option.

Step 6: –

Project Run: –

  • Press F5 key from keyboard or click on ‘Start’ from ‘Run menu’ for run the project
  • Then Type “any name” to ‘Text 1 box’
  • Then Type “any Item name”  to ‘Text 2 box’
  • Then Type “Value” to ‘Text 3 box’.
  • Then click on ‘MESSAGE’ button and display the message box (which you get free).

message-box-project

  • Then click on ‘Ok’ from message box (project 1 box)
  • Then click on ‘Clear button’ for clear the Text Box.
  • Then click on ‘Exit Button’ for close the result window.

This is the simple way to display Visual Basic Message Box. Now you can easily make it.






Related Posts: