|
-
Oct 1st, 2000, 04:37 AM
#1
Thread Starter
Junior Member
Hey Guys !
Is thr any1 who can help me in this problem ? I need a code
that will extract the shortenfilenam (only the filename)
from a total string passed by the commondialog ?
emranHASAN
-
Oct 1st, 2000, 04:51 AM
#2
Fanatic Member
-
Oct 1st, 2000, 06:56 AM
#3
Ex-Super Mod'rater
How Notepad does it
This is the code used to get the effect that is used by Notepad. It might help.
Code:
frmMain.Caption = "" & CommonDialog1.FileTitle & " - Notepad"
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Oct 1st, 2000, 07:40 AM
#4
_______
<?>
Code:
Option Explicit
Private Sub Command1_Click()
CommonDialog1.InitDir = "C:\" 'set dir path
CommonDialog1.CancelError = True 'used in cancel code
CommonDialog1.Filter = "All files(*.*)|*.*" 'filter for all files
CommonDialog1.ShowOpen 'show files
MsgBox CommonDialog1.FileTitle
'if you don't want the extension
Dim myLen As Integer
myLen = Len(CommonDialog1.FileTitle)
MsgBox Left(CommonDialog1.FileTitle, myLen - 4)
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 1st, 2000, 07:41 AM
#5
Ex-Super Mod'rater
Thats basicly the same as what i have just said
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Oct 1st, 2000, 08:44 AM
#6
Fanatic Member
<!>
Originally posted by HeSaidJoe
Code:
MsgBox Left(CommonDialog1.FileTitle, myLen - 4)
This will only work if the length of the extension is 3 chars. It will not work with .jpeg or .html files.
-
Oct 1st, 2000, 09:39 AM
#7
_______
<?>
Electroman:
How Notepad does it
This is the code used to get the effect that is used by Notepad. It might help.
I was merely pointing out that it is not specific to notepad and giving the commondialog code to do so.
Oetje:
Will put a fix for that in a moment.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 1st, 2000, 09:46 AM
#8
_______
<?>
Code:
'Corrected Version
Option Explicit
Private Sub Command1_Click()
CommonDialog1.InitDir = "C:\" 'set dir path
CommonDialog1.CancelError = True 'used in cancel code
CommonDialog1.Filter = "All files(*.*)|*.*" 'filter for all files
CommonDialog1.ShowOpen 'show files
MsgBox CommonDialog1.FileTitle
Dim SearchString, SearchChar, MyPos
SearchString = CommonDialog1.FileTitle ' String to search in.
SearchChar = "." ' Search for "."
MyPos = InStr(1, SearchString, SearchChar, 1)
'if found MyPos will be > 0
If MyPos > 0 Then
MsgBox Left(CommonDialog1.FileTitle, MyPos - 1)
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|