Thread: Snippets Vault

Page 8 of 8 FirstFirst ... 678
Results 106 to 113 of 113
  1. #106
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    Quote Originally Posted by stokerbandit View Post
    Hello, here is the code for a simple Text-To-Speech program.

    This should be added to a button and reads the text that is wrote in the "textbox1"

    Code:
            Dim SAPI
            SAPI = CreateObject("sapi.spvoice")
            SAPI.Speak(TextBox1.Text)
    There (: Enjoy!


    Please follow me on twitter for more! ->

    If you want me to make a tutorial just make a comment
    Moved to the correct place.
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  2. #107
    unit5678's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    5

    Show available diskspace and fullsize

    Code:
            
            Dim fullsize As Long
            fullsize = My.Computer.FileSystem.GetDriveInfo("C:\").TotalSize / 1024 / 1024 / 1024 '= Size in GB
            'Divide by 1024 once for KB, twice for MB and three times for GB
    
            Dim spaceleft As Long
            spaceleft = My.Computer.FileSystem.GetDriveInfo("C:\").AvailableFreeSpace / 1024 / 1024 / 1024 '= Size in GB
            Label1.Text = "C:\ has " & spaceleft & " GB out of " & fullsize & " GB available"
    
        End Sub

  3. #108
    DawgiiStylz's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Dawg House
    Posts
    7,811
    Reputation
    219
    Thanks
    2,896
    My Mood
    Tired

    Convert BBCode to HTML code

    Code:
    Public Function BBCode(ByVal strTextToReplace As String) As String
    
    
            '//Define regex
            Dim regExp As Regex
    
    
            '//Regex for URL tag without anchor
            regExp = New Regex("\[url\]([^\]]+)\[\/url\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<a href=""$1"">$1</a>")
    
    
            '//Regex for URL with anchor
            regExp = New Regex("\[url=([^\]]+)\]([^\]]+)\[\/url\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<a href=""$1"">$2</a>")
    
    
            '//Image regex
            regExp = New Regex("\[img\]([^\]]+)\[\/img\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<img src=""$1"" />")
    
    
            '//Bold text
            regExp = New Regex("\[b\](.+?)\[\/b\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<b>$1</b>")
    
    
            '//Italic text
            regExp = New Regex("\[i\](.+?)\[\/i\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<i>$1</i>")
    
    
            '//Underline text
            regExp = New Regex("\[u\](.+?)\[\/u\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<u>$1</u>")
    
    
            '//Font size
            regExp = New Regex("\[size=([^\]]+)\]([^\]]+)\[\/size\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<span style=""font-size: $1"">$2</span>")
    
    
            '//Font color
            regExp = New Regex("\[color=([^\]]+)\]([^\]]+)\[\/color\]")
            strTextToReplace = regExp.Replace(strTextToReplace, "<span style=""color: $1"">$2</span>")
    
    
            Return strTextToReplace
        End Function
    Credits to owner

  4. #109
    zJester's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Just wanted to say that this is an excellent resource. -thanks-

  5. #110
    sandrino's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    12
    Reputation
    10
    Thanks
    13
    nice codes, it will help alot of people

  6. #111
    MPGBat's Avatar
    Join Date
    Oct 2018
    Gender
    female
    Posts
    17
    Reputation
    10
    Thanks
    5
    My Mood
    Amused

    Bookmarking

    Bookmarking this page these are very helpful.
    Was just about to make a program n found a snippet on here that would help

  7. #112
    heiron70's Avatar
    Join Date
    Sep 2014
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    4

    VB .Net read xml file

    how to read xml file in VB .Net
    code
    Code:
    Dim readXML As XmlReader = XmlReader.Create(New StringReader(xmlNode))
    While readXML.Read()
        Select Case readXML.NodeType
            Case XmlNodeType.Element
                ListBox1.Items.Add("<" + readXML.Name & ">")
                Exit Select
            Case XmlNodeType.Text
                ListBox1.Items.Add(readXML.Value)
                Exit Select
            Case XmlNodeType.EndElement
                ListBox1.Items.Add("")
                Exit Select
        End Select
    End While
    from vb.net-informations
    Last edited by heiron70; 06-14-2019 at 09:09 AM.

  8. #113
    heiron70's Avatar
    Join Date
    Sep 2014
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    4

    Smile compare 2 strings in VB .Net

    how to compare 2 strings in in VB .Net simple code

    code:
    Code:
    Public Class Form1
        Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
            Dim str1 As String
            Dim str2 As String
    
            str1 = "vb.net"
            str2 = "VB.NET"
    
            Dim result As Integer
    
            result = String.Compare(str1, str2)
            MsgBox(result)
    
            result = String.Compare(str1, str2, True) 'true is case insensitive
            MsgBox(result)
        End Sub
    End Class
    result is Integer : returns less than zero, zero or greater than zero.
    Less than zero : str1 is less than str2.
    Zero : str1 is equal to str2.
    Greater than zero : str1 is grater than str2.

    When you run this program first you get -1 in message box and then 0
    Last edited by heiron70; 06-14-2019 at 07:52 PM.

Page 8 of 8 FirstFirst ... 678