First Snips (Replace :) with real smiley image)

Use this board to post your code snippets - tips and tricks
13 posts Page 1 of 2
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Hello Guys,

Well this will be the first time i gonna do this
maybe in the future i do more :D

this code i have work with a friend of my.
he always wanted to replace his text smiley's into a real one.well ...
today it finally did:
Code: Select all
'What do we need?:
'Richtextbox


Private Sub RichTextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
'When you add :p this text it will change directly into a smiley
'Just add more smileys and always create a new Sub PasteSmiley

        Dim matches = Regex.Matches(Me.RichTextBox1.Text, ":\)")
        Dim matches2 = Regex.Matches(Me.RichTextBox1.Text, ":p")

        For Each m As Match In matches

            If m.Success Then

                Me.RichTextBox1.SelectionStart = m.Index
                Me.RichTextBox1.SelectionLength = m.Length

                Me.PasteSmiley()

            End If

        Next

        For Each m As Match In matches2

            If m.Success Then

                Me.RichTextBox1.SelectionStart = m.Index
                Me.RichTextBox1.SelectionLength = m.Length

                Me.PasteSmiley2()

            End If

        Next

        matches = Nothing
        matches2 = Nothing
    End Sub

    Public Sub PasteSmiley()

        Using i = Image.FromFile("C:\temp\smile.gif")

            Clipboard.SetImage(i)

            Me.RichTextBox1.Paste()

        End Using

    End Sub

    Public Sub PasteSmiley2()

        Using i = Image.FromFile("C:\temp\smile2.gif")

            Clipboard.SetImage(i)

            Me.RichTextBox1.Paste()

        End Using

    End Sub
Well hope you like this guys
and BE CAREFUL be nice to me...

Dummy1912
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Hey Tim,
Nice, I've never seen this here.
Thanks for sharing this with us, and I have been searching for something for months lol.
Keep it up :D cooll;
You're crazy!
I'm not crazy, my mother had me tested. ~Sheldon Cooper
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Hey Buddy,

I'm happy to hear that
well maybe next time if you search for something ask me :D maybe i can help you out blusho;
Tim
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Cool tutorial Tim!! Useful for a chat app!! :D
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

Cool
YouTube Downloader v3.0
Image
Image
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

blusho; thanks guys
hope i can add more soon :D

Dummy1912
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Very nice, thank you alot, like agust, i have been searching for this for months.
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Such things is hard to find, thanks for posting Tim!
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

thanks buddy :D
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1891
Joined: Wed Dec 16, 2009 9:56 pm

Awesome Job!!
Going to use this in a chat, thank you!
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
13 posts Page 1 of 2
Return to “Quick Snips”