Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27501

Split recalled text in 2 lines

$
0
0
Hi,

I am more-less new in programming, so I need a little help, even though the question may sound trivial. I am making a program in Visual Basic 2010 Express to help me learn German. I have made it and it works, but I have a problem. Here is the code:

Code:

Imports System
Imports System.IO

Public Class Form1
    Private randomizer As New Random
    Private y As Integer = 0

    Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        Dim sr As New System.IO.StringReader(My.Resources.verb)
        Dim sr2 As New System.IO.StringReader(My.Resources.predlog)
        Dim sr3 As New System.IO.StringReader(My.Resources.primer)
        Dim generator As New Random
        Dim ran As Integer = 0
        Dim curline As Integer = 0
        Dim strVerb As String
        Dim strPrep As String
        Dim strPrimer As String

        Randomize()
        ran = Rnd() * 931

        Do Until ran = curline
            strVerb = txtVerb.Text
            txtVerb.Text = sr.ReadLine()
            curline += 1
            strPrep = sr2.ReadLine()
            txtPrep.Text = strPrep
            strPrimer = sr3.ReadLine()
            txtPrimer.Text = strPrimer
       
        Loop
        ran = curline



    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        Dim strVerb As String
        Dim strPrep As String
        Dim strPrimer As String

        strVerb = ""
        strPrimer = ""
        strPrep = ""
        txtVerb.Text = strVerb
        txtPrimer.Text = strPrimer
        txtPrep.Text = strPrep

    End Sub
End Class

I am still bad with databases so I have to work like this at the moment. I have 3 text files, the first one contains verbs all one under another, second one has prepositions, and the third one examples. Program creates random value and recalls lines from documents with String Reader.

My problem is that some verbs go with two different prepositions, or two or more examples are given. I have a table in Word 2007, from where I extracted every column in separate documents (Verb, Preposition and Example). I need verb, it's prepositions and it's examples on the same line, but the problem is that I had more lines in Prepositions document, and Examples document, because one verb can go with more prepositions and examples, and in Word table they were one under another in the same cell. So, in my resource files, I have split them with ";" mark, so I got what I wanted. What I want to do now is when such verb is chosen and value is recalled to split all prepositions at ";" mark into new line. For example:

Now it's like this in my text box for Prepositions:
von+Dativ; in+Akkusativ

And I want to get this in my text box:
von+Dativ;
in+Akkusativ

Is it possible? I have researched a lot, and lost two days in trying to make this happen, but I didn't find a solution... I would appreciate any help. Thanks :)

Viewing all articles
Browse latest Browse all 27501

Trending Articles