Function StripPath(T$) As String
Dim x%, ct% StripPath$ = T$ x% = InStr(T$, "\") Do While x% ct% = x% x% = InStr(ct% + 1, T$, "\") Loop If ct% > 0 Then StripPath$ = Mid$(T$, ct% + 1) End Function 'You would use it as File = StripPath("c:\windows\hello.txt") The Common Dialog Control used to have a fact that annoyed lots of people it doesn't have the Properties for making it appear in a specific location. But, this can be done with some quick thinking. With some research, I found out that the CommonDialog Control will appear in the Top-Left Corner of its parent. Therefore, if you place it inside a PictureBox Control, it will appear in the Top Left corner of the Control. Therefore if you can center the corner of the PictureBox, you can center the CommonDialog Control as well. Strip Filename from Full Path You would be required to strip just the filename from a full path. The following function will return just the filename, out of the full path. |