PDA

Click to See Complete Forum and Search --> : Convert char[] to string


vbzero
Jun 25th, 2002, 08:11 AM
How can I convert a character array to a string in C#?

thx!

Cander
Jun 25th, 2002, 08:25 AM
StringBuilder has a method called Append that accepts a char array as a parameter..so try this

StringBuilder mystring = new StringBuilder("");
mystring.Append(yourarray);
string final = mystring.ToString();

vbzero
Jun 25th, 2002, 08:31 AM
thanks Cander!

BTW: I already asked that before...

Do you know how to drag a textfile into a textbox and
then display the content of that file (like notepad does)?

thx!

Cander
Jun 25th, 2002, 08:37 AM
Beats the heck out of me.. All I know is, you can use the DragDrop event to detect the dragging then use the FileStream classes to open the file and place it in the textbox, but how to actually get the location of the file dragged so you can open it, I just have no clue

:confused:

Ill check a couple resources to see if I can find something

Cander
Jun 25th, 2002, 08:41 AM
here we go. This is for the Rich Text Box, but it should give you an idea.

http://216.239.51.100/search?q=cache:pggfLEAof3UC:msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformsdragdropeffectsclasstopic.asp+drag+and+drop+text+file+c%23&hl=en&ie=UTF-8