Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. delete path..

delete path..

Scheduled Pinned Locked Moved Visual Basic
tutorialquestionc++
2 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pnpfriend
    wrote on last edited by
    #1

    can anyone please give me sample code or example for deleting part of the string.. Dim str As String str = "c:\temp\folder1" how can i delete "\folder1" from str so str will be only "c:\temp" I know how to do in c++ but do not know how to do in VB though. Is String has any functions like CString? in C++ i can use CString::Find('\') and CString::Right() methods.. what about in VB. any functions that will do the same as above functions??? thank you

    P 1 Reply Last reply
    0
    • P pnpfriend

      can anyone please give me sample code or example for deleting part of the string.. Dim str As String str = "c:\temp\folder1" how can i delete "\folder1" from str so str will be only "c:\temp" I know how to do in c++ but do not know how to do in VB though. Is String has any functions like CString? in C++ i can use CString::Find('\') and CString::Right() methods.. what about in VB. any functions that will do the same as above functions??? thank you

      P Offline
      P Offline
      pnpfriend
      wrote on last edited by
      #2

      I got it.. that's what i did Dim fileName As String Dim path As String Dim index As Integer path = "c:\temp\testing\folder" path = frmPrinterProperties.IDpath.Text ' deleting the last folder name.. index = InStrRev(path, "\", -1, 1) ' find "\" reversly in the path string path = Mid(path, 1, index) ' get what ever right before "\" fileName = path & "new folder" ' now "c:\temp\testing\new folder"

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups