Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
| Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 13th, 2006, 06:47 PM
Authorized User
 
Join Date: Apr 2006
Location: , , Canada.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Replacing characters in a string

Hello. Ok, what I am doing is using an "OpenFileDialogBox" to allow the user to select the location of Internet Explorer on their computer (in case it isn't in the default Program Files\Internet Explorer\iexplore.exe), and then saving the value of that into a database so that later, I can use the stored path to open it with "System.Diagnostics.Process.Start()".

However, the path from the OpenFileDialogBox is something like "C:\Program Files\Internet Explorere\IExplore.exe", and the System.Diagnostics.Process.Start() method requires the backslashes to be escaped with, well, a backslash.

What I need is a for loop or something that will loop through each character in a string and replace each "\" with a "\\". Thank you in advance.

Computers will never surpass the human brain; no computer will ever be able to replicate human stupidity.
__________________
If only computers could write programs themselves...
  #2 (permalink)  
Old June 14th, 2006, 09:18 PM
Registered User
 
Join Date: Mar 2006
Location: HCM, HCM, Vietnam.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to puppyonline Send a message via Yahoo to puppyonline
Default

i think use @ before this string .
axam :
 @"C:\Program Files\Internet Explorere\IExplore.exe".

  #3 (permalink)  
Old June 16th, 2006, 11:31 PM
Authorized User
 
Join Date: Apr 2006
Location: , , Canada.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, thank-you! This is exactly what I needed.

Computers will never surpass the human brain; no computer will ever be able to replicate human stupidity.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing multiple characters in a string philboparker BOOK: XSLT Programmer's Reference, 2nd Edition 0 May 20th, 2008 04:38 PM
Separating strings and replacing characters sunrain XSLT 4 April 7th, 2008 09:33 AM
replacing numbers in a string cole SQL Server 2000 4 April 2nd, 2007 04:24 PM
Replacing characters in external csv file Axxess Access VBA 2 July 15th, 2005 01:39 AM
Replacing a character from string itHighway Classic ASP Basics 5 March 14th, 2005 11:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.