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 :




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

No comments: