dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: How to convert image to binary and get result in text box

  1. #1
    Join Date
    Dec 2016
    Posts
    13

    How to convert image to binary and get result in text box

    I need to convert image to binary and get result in text box .

    Image found in path D:/person.jpg

    i using the following function :



    Code:
    public static byte[] ImageToBinary(string _path)  
    {  
    FileStream fS = new FileStream(_path, FileMode.Open, FileAccess.Read);  
    byte[] b = new byte[fS.Length];  
    fS.Read(b, 0, (int)fS.Length);  
    fS.Close();  
    return b;  
    }
    How to receive the value returned from function ImageToBinary in textbox1 ?

    I work in c# windows form c#

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,227

    Re: How to convert image to binary and get result in text box

    What do you want to display in the text box, 0's and 1's?

  3. #3
    Join Date
    Dec 2016
    Posts
    13

    Re: How to convert image to binary and get result in text box

    yes

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,227

    Re: How to convert image to binary and get result in text box

    Have you tried calling ToString () on the byte array and set the text box to the string?

  5. #5
    Join Date
    Dec 2016
    Posts
    13

    Re: How to convert image to binary and get result in text box

    Can you show me how to do that

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,227

    Re: How to convert image to binary and get result in text box

    Quote Originally Posted by ahmed.barbary View Post
    Can you show me how to do that
    Sure, post the code you have so far that calls the ImageToBinary method.

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)