Article View: be.comp.programming
Article #10618Re: extensie - VB6
From: c-rim
Date: Sun, 03 Mar 2002 23:04
Date: Sun, 03 Mar 2002 23:04
44 lines
2318 bytes
2318 bytes
"www.place2b.ht.st" </> wrote in message
news:3c826180$0$250$ba620e4c@news.skynet.be...
> hoe kan je (als je bv met CommonDialog een bestand 'geopend' hebt) de
> extensie verwijderen?
> gewoon de laatste 4 tekens verwijderen kan niet aangezien je soms meer dan
4
> tekens moet verwijderen (.htm -> .html -> .dhtml ...)
De standaard is nochtans 3 tekens, spijtig dat ertegen gezondigd wordt.
begin crappy.code
Public Sub ChangeExtention(strFileName As String, strExt As String)
Dim iLoc As Integer
Dim strFil3 As String
iLoc = InStr(iLoc + 1, strFileName, ".", vbTextCompare)
If iLoc = 0 Then
MsgBox "You specified a crappy filename, please check for brains",
vbOKOnly, "error: User input"
Exit Sub
Else
iLoc = 1 'reset for calcul
Do Until iLoc = 0 'if there is still a . in remaining bit of string
doevents
iLoc = InStr(iLoc + 1, strFileName, ".", vbTextCompare)
'get all text up to dot, unless iLoc is set to 0
If iLoc <> 0 Then strFil3 = Left(strFileName, iLoc)
Loop
strFil3 = strFil3 & strExt
MsgBox strFil3 'Replace this line with events you want happened
'new filename is loaded into variable
strFil3
End If
End Sub
Technical Details
Message-ID:
<4_xg8.234649$rt4.22535@afrodite.telenet-ops.be>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!proxad.net!fr.usenet-edu.net!usenet-edu.net!newsfeeds.belnet.be!news.belnet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mailReferences:
<3c826180$0$250$ba620e4c@news.skynet.be>Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit X-Google-Thread: fcea4,5bb92d3f755b6812 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2002-03-03 15:04:32 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!proxad.net!fr.usenet-edu.net!usenet-edu.net!newsfeeds.belnet.be!news.belnet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mail From: "c-rim" <crim@home.com> Newsgroups: be.comp.programming References: <3c826180$0$250$ba620e4c@news.skynet.be> Subject: Re: extensie - VB6 Lines: 48 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <4_xg8.234649$rt4.22535@afrodite.telenet-ops.be> Date: Sun, 03 Mar 2002 23:04:32 GMT NNTP-Posting-Host: 213.224.68.158 X-Complaints-To: abuse@pandora.be X-Trace: afrodite.telenet-ops.be 1015196672 213.224.68.158 (Mon, 04 Mar 2002 00:04:32 MET) NNTP-Posting-Date: Mon, 04 Mar 2002 00:04:32 MET Organization: Telenet Internet