Hi,
know one of this special cases where you want a user can choose a file to open? All you need is a Open File Dialog and these few lines of code

GeSHi (vb):
Private Function ShowOpen(hWndOwner As Long, sFilter As String, sTitle As String, Optional sDir As String = "", Optional nFlags As Long = OFN_EXPLORER) As String
'Fill the struct with some data ;)
OFName.lStructSize = Len(OFName)
OFName.hWndOwner = hWndOwner
OFName.hInstance = App.hInstance
'The filter should be something like this :
'filter-name|*.filter-extension|filter-name2|*.filter-extension2
'Example: All Files (*.*)|*.*|VB-Projects (*.VBP)|*.vbp ... and so on
OFName.lpstrFilter = Replace$(sFilter, "|", vbNullChar)
OFName.lpstrFile = String(255, vbNullChar)
'Maximum number of selectable files
OFName.nMaxFile = 255
OFName.lpstrFileTitle = String(255, vbNullChar)
OFName.nMaxFileTitle = 255
OFName.lpstrTitle = sTitle
OFName.flags = nFlags
OFName.lpstrInitialDir = sDir
If GetOpenFileName(OFName) Then
ShowOpen = Replace$(OFName.lpstrFile, vbNullChar, "")
Else
ShowOpen = ""
End If
End Function
Created by GeSHI 1.0.7.20
This is the main function, you need some declarations as well...
 
I've attached a sample application... so have fun
Members Only - This post contains information only for members!