Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i have a window application in vb.net.

i need to add smilies or emotions in richtextbox with text (like yahoo chat).

suppose i have written: hi how are you -smile-
it will replace: hi how are you and (-smile- with image)

thanks in advance. please help me.
Posted

This article [^]should suit your requirements.
 
Share this answer
 
Comments
kals84 28-Mar-11 3:34am    
thanks for the solution but i need the code in vb.net not in c# as i don't know c#
Smithers-Jones 28-Mar-11 6:43am    
Sigh. Google for "convert c# to vb.net".
Sergey Alexandrovich Kryukov 28-Mar-11 22:30pm    
Yes, good matter, a 5.
--SA
Hope this[^] might help you.
 
Share this answer
 
You can display a UIElement, such as an Image or a Button, in a RichTextBox.

This enables rich text scenarios, such as displaying content from a chat client and showing emoticons.

UI elements are active when the RichTextBox is in read-only mode and inactive in edit mode. For example, they can respond to input and receive focus only when they are in read-only mode. Use the InlineUIContainer tag to add content that is derived from UIElement.

The following shows how to add an image to a RichTextBox.
VB
'A RichTextBox with an image.
                      Private
                      Sub ImageRTB()
    'Create a new RichTextBox.Dim MyRTB AsNew RichTextBox()

    ' Create a Run of plain text and image.Dim myRun AsNew Run()
    myRun.Text = "Displaying text with inline image"Dim MyImage AsNew Image()
    MyImage.Source = New BitmapImage(New Uri("flower.jpg", UriKind.RelativeOrAbsolute))
    MyImage.Height = 50
    MyImage.Width = 50
    Dim MyUI AsNew InlineUIContainer()
    MyUI.Child = MyImage

    ' Create a paragraph and add the paragraph to the RichTextBox.Dim myParagraph AsNew Paragraph()
    MyRTB.Blocks.Add(myParagraph)

    ' Add the Run and image to it.
    myParagraph.Inlines.Add(myRun)
    myParagraph.Inlines.Add(MyUI)

    'Add the RichTextBox to the StackPanel.
    MySP.Children.Add(MyRTB)
EndSub

Extracted from: http://msdn.microsoft.com/en-us/library/ee681613(v=vs.95).aspx[^]

Hope this helps,
AlienHamster
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900