How do I take a specific part of text from a label and store it in a variable???


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How do I take a specific part of text from a label and store it in a variable???

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Greece - Athens
    Posts
    6

    Question How do I take a specific part of text from a label and store it in a variable???

    Hello guys!!!

    I need your help here...
    I have a label which takes a path from a file in my hard drive.
    Example: C:\Documents and Settings\All Users\Desktop\none.exe

    I want to store this path in to a variable but with out the last part
    with file.
    Example: C:\Documents and Settings\All Users\Desktop

    I don't want to write it manualy.
    Example:
    Dim A as String
    A = "C:\Documents and Settings\All Users\Desktop"


    I want to write it like this:
    DIM A as String
    A = Label1.Caption


    So, how can I take a specific part of text from this label and
    store it in "A" variable???

    Thanx!!!
    Last edited by Simonetos; 09-27-2005 at 07:12 PM.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Code:
    Dim Path As String
    Path = Label1.Caption
    
    ' Find last backslash
    Dim Backslash As Integer
    Backslash = InStrRev(Path, "\")
        
    ' Assign everything left of backslash to A
    Dim A As String
    A = Left(Path, Backslash - 1)
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Sep 2005
    Location
    Greece - Athens
    Posts
    6
    Thanx my friend!!!
    It's working

    See you in here!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center