Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Sunday, July 31, 2011

VB- 76 : Calculate Income Tax

Create a VB program to calculate the income tax.User will put his Annual Income in the box and by clicking on "Income Tax" button, message box will show his income tax according to the following rule :

Rs
Tax
0 – 50,000
No Tax
50,000 – 60,000
10% of Annual Income
60,000 – 1,50,000
20% of Annual Income
More than 1,50,000
30% of Annual Income


Refer Pay Slip of an Employee , Calculate the Gross & Net Salary of an Employee also



(A)Program Design : 



(B) Property(Controls Used) :
  • 2 Labels
  • TextBox  (Text1-To get Annual Income from the user)
  • One Command Button
  • TextBox (Text2-To show the Income Tax)

(C) Attaching Code to the Object :



Private Sub Command1_Click()
Dim AI As Double
AI = Val(Text1)
If AI > 0 And AI < 50000 Then
Text2 = "No Tax"
Else
If AI > 50000 And AI < 60000 Then
Text2 = AI * 0.1
Else
If AI > 60000 And AI < 150000 Then
Text2 = AI * 0.2
Else
If AI > 150000 Then
Text2 = AI * 0.3
End If
End If
End If
End If
End Sub

(D) Output :


(E) Errors :
If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.


Saturday, July 30, 2011

VB-75 : Displays shape according to the entered value

Write a VB program in which function accepts the integer value from the user and displays the diamond shape according to the user input.


(A)Program Design :
 
(B) Property(Controls Used) :
  • A Label with Caption "Enter Number"
  • A Text Box to enter number
  • A command Button with Caption "Display"
  • A List Box to display Shape
(C) Attaching Code to the Object :
Private Sub Command1_Click()
Dim i
Dim j
Dim NumLines, str

NumLines = CInt(Text1)
List1.Clear

For i = 0 To NumLines / 2
For j = i To NumLines / 2 + 1
str = str & ""
Next

For j = 0 To i Step 1
str = str & "**"
Next

List1.AddItem (str)
str = ""
Next

For i = 1 To NumLines / 2
For j = 0 To i + 1
str = str & " "
Next

For j = i To NumLines / 2
str = str & "**"
Next

List1.AddItem (str)
str = ""
Next

End Sub


(D) Output :
(E) Errors :
If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.


===============================================
===============================================

Friday, July 29, 2011

VB-74 : Resultant Length of 2 concatenated Strings

Write a VB program to accept 2 given strings , concatenate them and find the  length of the  resultant string.

Refer  Total words,Characters,sentence,length of ... also.



(A)Program Design : 


(B) Property(Controls Used) :
  • 4 Labels 
  • 4 Text Boxes (Text 1,2,3,4)
  • One Command Button (Caption-Concatenate)

(C) Attaching Code to the Object :


Private Sub Command1_Click()

Text3.Text = Text1.Text & Text2.Text

Text4.Text = Len(Text3.Text)

End Sub


(D) Output :




(E) Errors :

If found any errors while running your VB program, or want to put your comment about any  program , please click Comment section , to post.


===============================================
===============================================


VB-73 : Calculate Area & Volume


Write a VB program for a company to produce various sized basketballs , to calculate the area and volume of different sized balls,so that they will know how much air to pump in the ball,and how much paint they will need to paint it.Radius may be taken from the user as input of the program.
Area=4*22/7*(Radius)^2
Volume=4/3 * 22/7 * (Radius)^3
======================================
 (A)Program Design : 

(B) Property(Controls Used) :
  • 3 Labels
  • 3 TextBoxes(Text 1,2,3)
  • One Command Button (Calculate)

(C) Attaching Code to the Object :
Private Sub Command1_Click()
Dim radius As Single
Dim area, volume As Double

radius = Val(Text1)
area = 4 * 22 / 7 * (radius * radius)
volume = 4 / 3 * 22 / 7 * (radius * radius * radius)

Text2 = Round(area, 2)
Text3 = Round(volume, 2)
End Sub



(D) Output :
(E) Errors :
If found any errors while running your VB program, please click this link   Possible Errors while running VB Programs to get a solution.

      • ====================================================================
        Back to Home   &  VB
    ===========================================================

    Thursday, July 28, 2011

    Possible Errors while running VB Programs

    Error Detection :
    • There is always be a possibility to have errors while running the program.So , we have to know the type of errors occurring in each type of programs.Error detection capacity is an important thing in programming.
    • This is a page where you can add/discuss about Errors while running any of the VB Programs (And , If its from any of the Program in this Blog, Kindly mention the program number also).
    • Please Use Post a Comment section to post the errors , and if possible , their solution too... :)
    • ==========================================================================
    Or , VBForums

        • ====================================================================
          Back to Home   &  VB
      ===========================================================

      VB-72 : Occurrence of a String

      Write a VB program to accept 2 given strings from the user and count the number of times the second string appears in the first string.
      Design and display a splash screen as your program loads.

      Click to see a simple program of this type The number of digits in the entered Number...
      ============================================
      This Problem is divided into 2 parts:

      1. Provide a Splash Screen
      2. Provide a form,which find the occurrence of a string from another string.


      (A)Program Design : (1)

      Add a form to the project and select "Splash Screen" to get the screen as given below :



      (B)Attaching Code to the Object :


      Private Sub Form_Load()
          lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
          lblProductName.Caption = App.Title
      End Sub



      (A)Program Design : (2)



      (B) Property(Controls Used) :


      • 4 Labels 
      • 3 TextBoxes, ( Set the first TextBox property - Multiline-True , ScrollBars-3)
      • One Command Button Find

      (C) Attaching Code to the Object :

      (The below given code starting from Public fMainForm As frmMain , may be added into a module by selecting Project-->Add Module , If there happen any error in the output)
      Private Sub Command1_Click()
      Dim pos, p_pos, cnt As Integer
      p_pos = 1
      pos = 1
      cnt = 1

      Do
      pos = InStr(p_pos, Text1, Text2, vbTextCompare)
      p_pos = p_pos + pos
      If pos <> 0 Then cnt = cnt + 1
      Loop While pos <> 0

      Text3.Text = cnt
      End Sub
      Public fMainForm As frmMain

      Sub Main()
      frmSplash.Show
      frmSplash.Refresh
      Set fMainForm = New frmMain
      Load fMainForm
      Unload frmSplash
      fMainForm.Show
      End Sub


      D) Output :

      =========================================================================
      Refer Total words,Characters,sentence,length of ... and 
      1. Count Blanks,Tabs,etc in a String
      2.   Find rightmost occurrence of n-length string

          • ====================================================================
            Back to Home   &  VB
        ===========================================================

        Wednesday, July 27, 2011

        VB-71 : Create a Menu as per the format given

        Create a Menu using Menu Editor as per the format given below :

        FILE                                            EDIT                                 HELP
             New     CTRL+N                           Add
             Open    CTRL+O                        Change
             Save                                            Delete
             Save as
             Exit
                

        Refer Program Using Menu Bar and Creating Tool Bar with Click Event 


        ===============================================
        Here, File, Edit & Help is the Main Menu..and Others are sub-menus.....Given 2 Shortcuts for New & Open.
        Refer Design a Menu Bar also.
        Select Tools--> Menu Editor and create menus as per given below :









        ====================================================================
        =========================================================