Calculate the Sum and Average of Numbers in Visual Basic (Project 4)

with 1 Comment

Calculate the Sum and Average of Numbers:




Step 1: –

  • At first open Visual Basic0 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 position to ‘Form Window’: –

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

visual basic projevt

Step 3: –

Properties Settings: –

  • Select ‘Form1’from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Form1’ to ‘Sum and Average Project’ from properties window
  • Then select ‘Label1 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label1’ to ‘1st’ from Properties Window
  • Then select ‘Label 2 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label 2’ to ‘2nd’ from Properties Window
  • Then select ‘Label 3 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label 3’ to ‘3rd’ from Properties Window
  • Then select ‘Label 4 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label 4’ to ‘SUM’ from Properties Window
  • Then select ‘Label 5 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Label 5’ to ‘AVERAGE’ 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 ‘Text 2 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text 2’ from Properties Window
  • Then select ‘Text 3 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text 3’ from Properties Window
  • Then select ‘Text 4 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text 4’ from Properties Window
  • Then select ‘Text 5 box’ from Form Window and select ‘Text’ from Properties Window
  • Then remove or erase ‘Text 5’ from Properties Window
  • Then select ‘Command1 box’ from Form Window and select ‘Caption’ from Properties Window
  • Then replace ‘Command1’ to ‘Calculation’ 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.

Sum Average calculation VB
visual basic projevt

visual basic project

Visual basic project

Calculate the Sum and Average of Numbers

Step 4: –



Code writing:-

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

Code: – Text4. Text = Val (Text1.Text) + Val (Text2.Text) + Val (Text3.Text)

             Text5.Text = Text4.Text / 3

Note: – ‘Val’ = Volume of Text1 box.

  • Then double click on ‘Clear box’ or ‘Command 2 box’
  • Then input code to Command 2 code box.

Code: – Text1.Text = “”

              Text2.Text = “”

              Text3.Text = “”

              Text4.Text = “”

              Text5.Text = “”

Note: – “” = clear the Text box.

  • Then double click on ‘Exit box’ or ‘Command 3 box’
  • Then input code to Command 3 code box.

Code: – End

Visual basic 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 input any ‘Number’ to ‘Text 1 box’
  • Then input any ‘Number’ to ‘Text 2 box’
  • Then input any ‘Number’ to ‘Text 3 box’
  • Then click on ‘Calculation’ button.

visual basic project

  • Then click on ‘Clear button’ for clear the Text Box.
  • Then click on ‘Exit Button’ for close the result window.





Related Posts:

One Response

  1. himanshi kashyap
    | Reply

    hi

Leave a Reply