Hi, I'm writing a chat application in C# and I want to ask how I can insert pictures into textBox or richTextBox , you know, just something like this ;)

Thanx, Stivi (EU)

There is a method in textBox called CopyPicture();
Can be used without parameters or you can
instert a parameter of XlPictureAppearance type.
Sorry dont know any more hope this helps....

Hay man if u are still looking for a way to insert images into a TextBox here is a way. Just execute the following method.
PS: It uses a "RichTextBox"

public void InsertImage(string pic)  
        {
            //string lstrFile = fileDialog.FileName;
            string lstrFile = pic;
            Bitmap myBitmap = new Bitmap(lstrFile);
            // Copy the bitmap to the clipboard.
            Clipboard.SetDataObject(myBitmap);
            // Get the format for the object type.
            DataFormats.Format myFormat = DataFormats.GetFormat (DataFormats.Bitmap);
            // After verifying that the data can be pasted, paste
            if(richTextBox1.CanPaste(myFormat)) 
            {
                richTextBox1.Paste(myFormat);
            }
            else 
            {
                MessageBox.Show("The data format that you attempted site" + 
                    " is not supportedby this control.");
            }
            
        }

The only problem is that it loads the image into the clipboard before loadong it into the
textbox, please note!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.