0

Is it possible to display an image in a FreeTextBox? If yes, how can I do this?

Thank you in advance!

EDIT:

I want to load images from the attachment of an EmailMessage and display it in a FreeTextBox & Label.

EDIT 2:

This is the code I use:

        FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox,
            new ItemView(100));
        foreach (EmailMessage item in findResults.Items)
        {
            item.Load();
            if (!list.Contains(item.Id.UniqueId))
            {
                DataRow dr = dt.NewRow();
                dr["OutlookID"] = item.Id.UniqueId;
                dr["Onderwerp"] = item.Subject;
                dr["Omschrijving"] = item.Body + item.Attachments;
                dr["Meldingsdatum"] = item.DateTimeSent;
                dr["Melder"] = ad.GetLoginName(item.Sender.Name);
                dt.Rows.Add(dr);

                string s = System.Text.Encoding.UTF8.GetString(item.MimeContent.Content);

                FreeTextBox1.Text += s;

            }
Tassisto
  • 9,877
  • 28
  • 100
  • 157
  • I'm using the same control at the moment and I'm displaying the images. What is your code? – Neil Knight Mar 23 '11 at 09:51
  • I'm using it to display the body of EmailMessages and sometimes the body contains also images. But I can't see images in freetextbox – Tassisto Mar 23 '11 at 09:53
  • Are the images embedded in the email or are they stored on a server? – Neil Knight Mar 23 '11 at 09:59
  • Sorry, we don't delete questions, *two hours after they are asked*, because you haven't gotten any "good answers." I'd suggest you read [this blog post](http://blog.stackoverflow.com/2010/10/asking-better-questions/) for hints on how to ask better questions. If you want to draw attention to your question, you will be allowed to [place a bounty on it](http://stackoverflow.com/faq#bounty) after two days. You can also [edit your question](http://stackoverflow.com/posts/5219937/edit) to add additional information, which may make your question easier to understand and answer. –  Mar 23 '11 at 12:42

2 Answers2

1

same as displaying a image using html -

<img src="...."/>

can u post a sample that u have tried

Vinay B R
  • 8,089
  • 2
  • 30
  • 45
1

You'll want to do something like :

string s = System.Text.Encoding.UTF8.GetString(mime.Content);
FreeTextBox1.Text = s;
Neil Knight
  • 47,437
  • 25
  • 129
  • 188
  • I get this error: You must load or assign this property before you can read its value. – Tassisto Mar 23 '11 at 10:12
  • You are assigning `mime` to the `item.MineContent`? You could just use `item.MimeContent` in the `GetString` method. – Neil Knight Mar 23 '11 at 10:18
  • Without knowing what is on the page, it's going to be very difficult to help. Step through the code to find out where it is error-ing. – Neil Knight Mar 23 '11 at 10:34
  • I work with Exchange WebService Managed API to load EmailMessages from the server – Tassisto Mar 23 '11 at 10:36
  • Ok, it means that you have a `null` value somewhere and it isn't working. Unless you step through your code, you aren't going to pin point the problem. – Neil Knight Mar 23 '11 at 10:45