Results 1 to 5 of 5

Thread: Convert char[] to string

  1. #1

    Thread Starter
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347

    Question Convert char[] to string

    How can I convert a character array to a string in C#?

    thx!

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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();
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347
    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!

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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



    Ill check a couple resources to see if I can find something
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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...hl=en&ie=UTF-8
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width