To Literal String

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this little awful hack in my code

System.Windows.Forms.TextBox hack = new System.Windows.Forms.TextBox()
hack.Text = Registry.GetRegistryKey( Registry.ATSAT_KEY, Registry.DOWNLOAD_DIR)
if( Directory.Exists(hack.Text) == false
throw( new Exception( "Directory not found: " + hack.Text ) )

Essentially I would like to convert a string to a literal string (with no funky EOL and such characters) much like the TextBox.Text setter seems to be doing.

Could someone educate me on how to properly handle and process strings and why/how textBox.text is working

Thanks
 
How are you retrieving the value in your GetRegistryKey method? Sounds like
you have trailing nulls not trimmed from the string.

You could try the Registry implementation in the Smart Device Framework
(www.opennetcf.org/sdf/)

Peter
 
Thanks Peter

I did a TrimEnd('\0') and that resolved my problem. I was just curious as to why and how TextBox.Text converts the string ... :

Thanks for the help
 
Back
Top