Click here to Skip to main content
15,746,652 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
I have an App to test some methods.
In my "TestApp" I have 4 buttons: btnTekst, btnSplit, btnMid and btnUbound.
I have also 4 Textboxes: txtTekst, txtSplit, txtMid and txtUbound.

First thing I want to do is the whole tekst showing in the first Textbox. This is easy to do. Second thing is to split the tekst like this:

Public Class frmTestApp

    Private Sub frmTestApp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles MyBase.Load
    End Sub

    Private Sub btnTekst_Click(sender As System.Object, e As System.EventArgs) _
        Handles btnTekst.Click

        txtTekst.Text = "ADR;WORK;PREF:;;Straat 01;Plaats;;Postcode"

        Dim txt As String = txtTekst.Text
        Dim newTxtStrings As New List(Of String)

        'newTxtStrings = txt.Substring(txt.IndexOf(":") + 1).Split(";").Where(Function(txtString)
        '                                                                         Return txtString.Length > 0
        '                                                                     End Function).ToList

    End Sub

    Private Sub btnSplit_Click(sender As System.Object, e As System.EventArgs) _
        Handles btnSplit.Click

    End Sub

    Private Sub btnMid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles btnMid.Click

        txtMid.Text = txtTekst.Text

    End Sub

    Private Sub btnUbound_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles btnUbound.Click

        txtUbound.Text = txtTekst.Text

    End Sub
End Class

You she my code above. I want to split the text bij ":" and ";"..I have asked this earlier, but it's still not working as it should be.

If this is split, I want to Mid in the third textbox.
After that I want to use Ubound, but mabey I don't need the last function.
Can everyone help me out?
[no name] 27-Jun-12 9:27am    
"but it's still not working as it should be." is not a very helpful description of your problem. You have not declared "bij" much less tried to split it, according to your code.
OdeJong 28-Jun-12 4:17am    
I want to split it from out a vcf file:

N:De Jong
TEL;VOICE:0512 540221
TEL;WORK;FAX:0512 540540
TEL;FAX:0512 540221
ADR;WORK;PREF:;;Sjoerd Veltmanstraat 15;Drachten;;9203 NJ

It's only the adres part, that's not working.

ADR;WORK;PREF:;;Sjoerd Veltmanstraat 15;Drachten;;9203 NJ
I only need this line. This line must be show in: strAdres, strPostcode, strPlaats. This tree strings must be together one :strAdgegevens.

there are different fields in my app, every field that will fill with this info is insert into the database.

1 solution

My project is done!
thanks everyone for your help!
Share this answer

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