AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed Adeel Rizvi
Expertise
I can answers questions regarding web based and desktop based programming in VB.Net. Which can include XML, Custom Controls + Computer Hardware and Windows Turboshooting...etc. More Skills : 1 . PHP - > All Type Of CMS e.g. (Joomla,Drupul,PHPNuke...etc) 2 . ASP 3 . ASP.Net 4 . CMS 5 . MySql 6 . SQl Server 2000 & 2005 7 . Ms Access 8 . Web Designing 9 . Networking Turboshooting 10 . Windows Turboshooting 11 . Hardware Turboshooting All Type Of Work Related To IT I also Do Work as a Freelance as Application & Web Developer & Designer

Experience
i have 3 years work experience in software house and 4 years work experience for computer hardware and Networking..

Organizations
110 Solutions

Education/Credentials
Bsc (Honors)

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > Trim method from a File Name

Topic: VB.NET



Expert: Syed Adeel Rizvi
Date: 8/21/2007
Subject: Trim method from a File Name

Question
Hello,
Being a novice coder I many questions. So far I have managed to stumble may way through however I am in need of help now.

What I am trying to do is, take text from a text box and remove what ever is in that box from a list of loaded file names.
(eg.  original is file title is hello-how-are-you.txt and the text box text is "hello-how-are". once the code is run i want only you.txt left)
So far I am able to display the file paths and rename 1 file  what ever is in a text box.
Here is the code I have:

Private Sub BtnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStart.Click
       Dim progress As New Progress

       Dim newtext As String
       Dim nxt As Integer
     
       nxt = 0

       For Each strfilename As String In LstList.Items

           newtext = txtRemove.Text
           TabMain.Tag = LstList.Items(nxt)
           File.Move(TabMain.Tag, "C:\Users\Steve\Documents\test\" & newtext & ".mp3")

           nxt = nxt + 1
       Next
   End Sub

I know that will only allow me to rename one file and Im lost on how to make it do what I want it to.

Any help would be greatly appreciated. Thankyou for reading and I hope i was clear enough (sometimes Im no lol)

thanks
steve

Answer
Hello Sir

so in simple words you want to trim the filename ok

Function TrimFileName(byval strFilename as String)
Return Left$(strFilename,Len(strFilename)/2)
End Function

it will work if not then plz mail me syedadeel2@gmail.com

i dont have vb.net Installed on my pc so its my guess plz try it...


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.