Hey guys, i'm really confused. I created a string in Resource1.resx as file extensions for validation. string name is fileExt and values are "jpg","jpeg","bmp","png". I want to place these in the array and it will looks like this:
string[] fExt = { Project.Resource1.fileExt }
the problem now is when i debug it, it's not distributing into arrays and it shows in a single array. like this: "\"jpg\",\"jpeg\",\"bmp\",\"png\""
so the array now looks like this:
fExt[0] = "\"jpg\",\"jpeg\",\"bmp\",\"png\""
fExt[1] = null
fExt[2] = null
fExt[3] = null
How to resolve this? Any help would be really appreciated. Thanks in advance. Jim.
A million of THANKS!!! r.rajeshkhunt for it. it really solves my problem. Ive been trying to figure out how to fix and .Split is the solution. Though it contains still \, but i also managed to trick bu substring in each array.
jim_rosacena...
Member
31 Points
89 Posts
Resource file string is containing "\"
Jun 20, 2012 09:09 AM|LINK
Hey guys, i'm really confused. I created a string in Resource1.resx as file extensions for validation. string name is fileExt and values are "jpg","jpeg","bmp","png". I want to place these in the array and it will looks like this:
string[] fExt = { Project.Resource1.fileExt }
the problem now is when i debug it, it's not distributing into arrays and it shows in a single array. like this: "\"jpg\",\"jpeg\",\"bmp\",\"png\""
so the array now looks like this:
fExt[0] = "\"jpg\",\"jpeg\",\"bmp\",\"png\""
fExt[1] = null
fExt[2] = null
fExt[3] = null
How to resolve this? Any help would be really appreciated. Thanks in advance. Jim.
r.rajeshkhun...
Participant
1358 Points
250 Posts
Re: Resource file string is containing "\"
Jun 20, 2012 09:19 AM|LINK
I am assuming that you have stored extension in resource file like
"jpg","jpeg","bmp","png"
So when you retrieve this into string[] fExt = value from resource file; naturally it will not get split into array. You need to do it like below way.
string[] fExt = valuefromresourcefile.Split(',');Now you will have array of your value.
======================================
Microsoft® Community Contributor 2011 | AWARD
MCTS
My Blog
Follow Me
jim_rosacena...
Member
31 Points
89 Posts
Re: Resource file string is containing "\"
Jun 20, 2012 09:46 AM|LINK
A million of THANKS!!! r.rajeshkhunt for it. it really solves my problem. Ive been trying to figure out how to fix and .Split is the solution. Though it contains still \, but i also managed to trick bu substring in each array.