tonestauk
09-11-2003, 04:18 AM
I have created a text converter using VB6 but when l select a folder, where it lists the files within that folder, it lists all files. How do l created it so that l cant have some kind of drop down menu to show either *.*/*.txt/*.log files???, any ideas??, l attached the source code....
meggy_e
09-11-2003, 04:27 AM
you could use common dialog control. after you add the control, add this code :
<vb>
commondialog1.filter="Text files (*.txt)|*.txt|Log Files (*.log)|*.log|All Files (*.*)|*.*"
</vb>
note :make sure to add commondialog component to your project
tonestauk
09-11-2003, 07:39 AM
you could use common dialog control. after you add the control, add this code :
<vb>
commondialog1.filter="Text files (*.txt)|*.txt|Log Files (*.log)|*.log|All Files (*.*)|*.*"
</vb>
note :make sure to add commondialog component to your project
No, taht doesnt seem to have worked. Any other ideas??
Flyguy
09-11-2003, 07:54 AM
It does work, there must be something wrong with your code.
tonestauk
09-11-2003, 07:59 AM
ive put the code in and that, but when i run it, theres no drop down menu to select what l want to view. Like in word, you have an option to view .doc file .dot files or all files, thats what l want and it doesnt seem to do that??
Flyguy
09-11-2003, 08:02 AM
A working piece of code from an actual project:
Private Sub SaveSheet(sType As String)
Dim sFilter As String
Dim sFileName As String
' CommonDialog tonen
On Error GoTo errHandler
Select Case sType
Case "excel"
sFilter = "Excel files (*.xls)|*.xls"
Case "tab"
sFilter = "Tab delimitted files (*.*)|*.*"
End Select
' Set flags
CD.CancelError = True
CD.flags = cdlOFNNoReadOnlyReturn Or cdlOFNOverwritePrompt Or cdlOFNPathMustExist
' Set filters
CD.Filter = sFilter
'CD.DialogTitle = m_sReportTitle
CD.ShowSave
sFileName = CD.FileName
Select Case sType
Case "tab"
SaveTab sFileName
Case "excel"
SaveExcel sFileName
End Select
Exit Sub
errHandler:
' Cancel
End Sub
tonestauk
09-12-2003, 02:54 AM
A working piece of code from an actual project:
Private Sub SaveSheet(sType As String)
Dim sFilter As String
Dim sFileName As String
' CommonDialog tonen
On Error GoTo errHandler
Select Case sType
Case "excel"
sFilter = "Excel files (*.xls)|*.xls"
Case "tab"
sFilter = "Tab delimitted files (*.*)|*.*"
End Select
' Set flags
CD.CancelError = True
CD.flags = cdlOFNNoReadOnlyReturn Or cdlOFNOverwritePrompt Or cdlOFNPathMustExist
' Set filters
CD.Filter = sFilter
'CD.DialogTitle = m_sReportTitle
CD.ShowSave
sFileName = CD.FileName
Select Case sType
Case "tab"
SaveTab sFileName
Case "excel"
SaveExcel sFileName
End Select
Exit Sub
errHandler:
' Cancel
End Sub
This still makes no sense to me - sorry..???
Squishy
09-12-2003, 08:19 PM
Have you tried setting the filter in the IDE? (Properties window)