www.hitmill.com
link to hitmill.com home page
 

 

Open A File in Form Activate

This is the code to Open a File using the Common Dialog Box for FileOpen (VB6.0)


 
Private Sub Form_Activate()
 cdlCommon.CancelError =True
 cdlCommon.Flags = cdlOFNHideReadOnly ' Hides read only files
 cdlCommon.Filter = "All Files (*.*)|*.*|Text Files" & _
 "(*.txt)|*.txt|Gatch Files (*.bat)|*.bat|"
 ' Specify default filter
 cdlCommon.FilterIndex = 2
 cdlCommon.ShowOpen
End Sub

For the above code, you will have to click on Projects, Components and scroll to the Microsoft Common Dialog Control 6.0. Place a check mark next to the control, click Apply and OK. The Control is now in the ToolBox where, if you double click the new control, it will appear on your form. Name this control cdlCommon. Add Error Handlers to the code, if desired.



webmaster@hitmill.com
 
Updated -

© hitmill.com
All Rights Reserved