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

Monday, July 18, 2011

VB-49 : Display the contents of a text file using File Controls

Write an event procedure to display the contents of a text file using File Controls.

(Refer Copies files from one location to other also)



A)    Program Design : 


(B) Property(Controls Used) :
  •       DirListBox
  •       DriveListBox
  •       FileListBox (Pattern Property - *.txt;*.ini)
  •       RichTextBox (Is obtained by taking Project-->Components-->Microsoft Rich Text Control 6.0

(C) Attaching Code to the Object :

Dim fname As String
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
 Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub                      
Private Sub File1_Click()
If Dir1.Path = Drive1.Drive & "\" Then
fname = File1.Path & File1.List(File1.ListIndex)
Else
fname = File1.Path & "\" & File1.List(File1.ListIndex)
End If
RichTextBox1.LoadFile fname
End Sub
Private Sub Form_Load()
Drive1.Drive = "c:\"
Dir1.Path = Drive1.Drive & "windows"
File1.Path = Dir1.Path
End Sub

(C) Output :




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

VB-48 : Print Fibonacci Series

Design an application to print the Fibonacci Series.+

A)    Program Design : 


(B) Property(Controls Used) :
  •      2 Labels
  •      2 Text Boxes (Property of second text box is : Locked-True,Multiline-True,Scrollbars-Both,Text-(Blank)
  •       One Command Button with Caption Generate
(C) Attaching Code to the Object :

                        

Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = 0
b = 1
Text2 = ""
Do
Text2 = Text2 & a
c = a + b
a = b
b = c
If (a > valtext1.Text) Then
Text2 = Text2 & "."
Exit Do
Else
Text2 = Text2 & ","
End If
Loop
End Sub
Private Sub Text1_Change()
If Val(Text1.Text) > 100 Or Val(Text1) < 0 Then
MsgBox "Limit should between 0 and 100 only"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
SendKeys (Char(8))
End If
End Sub






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

VB-47 : Calculate the Gross & Net Salary of an Employee

Design a VB application to take input the Employee's Name,Employee No,Basic Salary,HRA,DA,City Allowance and Deductions.Calculate the Gross & Net Salary.

  • Gross Salary=Basic+HRA+DA+City Allowance-Professional Tax
  • Net Salary=Gross Salary-P.F


A)    Program Design :


(B) Property(Controls Used) :
  •      11 Labels
  •      10 Text Boxes (The Index Property of the 1st 6 text boxes should be from 0 to 5 respectively,,,Text Property of text boxes for entering Employee name & number should be kept as blank and all others are Zero,,,The Locked Property of the text boxes (For calculating Gross & Net Salary) should be kept as True
  •      One Command Button (Caption is Calculate)

(C) Attaching Code to the Object :

Private Sub Command1_Click()
Dim sum As Integer
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "Enter Employee Number and Name"
End If

For i = 2 To 5
sum = sum + Val(Text1(i).Text)
Next
sum = sum - Val(Text7.Text)
Text9 = sum
Text10 = sum - Val(Text8.Text)
End Sub                                                                                                            


Possible Error  :Method or Data Member not Found
====================================================================
=========================================================