Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with Regex
#1
Hey ive been working on how to make a "lng" file for your application and ive kinda succeded

Here is the code play with it as much as you want <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->
(IMPORTS)
Code:
Imports System.Text.RegularExpressions

(Textbox1.textchanged) (Hide it if you feel like it, it will still do its job <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile --> )

Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        Dim content As String = Replace(TextBox1.Text, Global.Microsoft.VisualBasic.ChrW(10), Nothing)
        Dim regex As New Regex("<language.*ButtonSend=""Name"".*ButtonName="".*""")
        Dim rbutton2 As New Regex("<language.*ButtonClear=""Name"".*ButtonName="".*""")
        '(Set.*buttonsend=""
        For Each m As Match In regex.Matches(content)
            Try
                Dim ButtonSend As String = m.Value.Split("""").GetValue(3)
                Dim ButtonClear As String = m.Value.Split("""").GetValue(7)
                Button1.Text = ButtonSend
                Button2.Text = ButtonClear
            Catch ex As Exception

            End Try

        Next
    End Sub

(Read config or lang file) I would set mine to Form load but you can allso make them able to change it so it will reload on a button or something
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = My.Computer.FileSystem.ReadAllText(My.Application.Info.DirectoryPath + "\Config.cfg")
    End Sub

[EDIT]
Download link to EXE to check it out and see that it is working fine <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->
<!-- m --><a class="postlink" href="http://dl.dropbox.com/u/12582973/CFG.zip">http://dl.dropbox.com/u/12582973/CFG.zip</a><!-- m -->
Website: <!-- m --><a class="postlink" href="http://www.PBAProductions.com">http://www.PBAProductions.com</a><!-- m -->
E-Mail: <!-- e --><a href="mailtoTongueatrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
Skype: Qwaxer
Youtube: Qwaxer
[Image: 2hnx8av.jpg]


Messages In This Thread
Working with Regex - by xolara - 02-24-2011, 05:08 PM
Re: Working with Regex - by xolara - 02-24-2011, 05:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Interation Not Working kismetgerald 9 31,401 01-20-2012, 04:30 AM
Last Post: kismetgerald
  DataBase - Login - Not Working Murcs 4 17,053 07-02-2011, 09:46 AM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)