I have some code that when you click on the filebox, it adds the filename to a path i.e. D:\Quake2\baseq2\maps\default.bsp. Is there a way to trim off the last 4 characters? (in bold).
Thanks
Printable View
I have some code that when you click on the filebox, it adds the filename to a path i.e. D:\Quake2\baseq2\maps\default.bsp. Is there a way to trim off the last 4 characters? (in bold).
Thanks
if u want to put it into a textbox it would be:
you can do with that what u need to doCode:Text1.Text = Left(Text1.Text, Len(Text1.Text) - 4)
thanks
The following method is more accurate.
It will allow for an extension of any length (e.g html or hc which are not the standard 3 length) whereas the above example does not.Code:sName = "MyFile.exe"
Print Left(sName, InStrRev(sName, ".") - 1)
Thanks megatron, but that method doesn't really apply to what I am doing because all the files have the same extension (.bsp). If it has a different extension, it won't show up in the file box since the pattern is *.bsp. Thanks though, I'll save that code for later, because I searched for it along time ago and couldn't find it.
[Edited by MidgetsBro on 11-25-2000 at 08:43 PM]