Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
OpenFileDialog f = new OpenFileDialog();
            f.ShowDialog();
            chemin = f.FileName;
            pictureBox1.ImageLocation = chemin;
         //  chemin.Replace("\", "|");


please sameone help me to replace "\" caracter with this "|"
Posted
Comments
CHill60 11-Jan-13 22:19pm    
So what's wrong with chemin = chemin.Replace("\, "/!); ? You've commened it out but not sure why
Shanu2rick 11-Jan-13 23:56pm    
What do you want to replace with("/" or "|")?

1 solution

The code you show here works, just as it is, to correctly set the ImageLocation Property of a PictureBox.

So why are you asking how to replace the back-slash character with a forward slash ?
 
Share this answer
 
Comments
mouadlhrch 18-Jan-13 19:40pm    
i try to stock location in data base
BillWoodruff 18-Jan-13 21:05pm    
Hi Mouadlhrch,

I'd like to suggest you edit your original question, and, if storing a .NET filepath in a database with "|" replacing the "\" character is an ABSOLUTE REQUIREMENT (excuse me for "shouting," but we can't use bold in comments in Q&A), then, clearly: that is the "real" question you are asking here.

If you edit your original question, then I will, of course, delete this "solution," if it's no longer relevant to what you really want to know :)

By the way, I'm (always) curious: what happens now if you try to store a .NET filepath with the "\" character in your database ? I assume that either "fails," or causes problems with other accesses to the database ?

good luck, Bill

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900