vbMarkO Posted September 25, 2005 Posted September 25, 2005 Heres my code I am having to Click the button over and over until the variable myInt > UBound(myChap) how can I make it so it iterates through until myINt is greater than UBound(myChap) Public myInt As Integer Public myChap() As String Private Sub cleanSweep() Dim strText As String strText = "1:1: Line of Text:" & vbCrLf & "1:2: Line of Text:" & vbCrLf & "1:3: Line: of Text" _ & vbCrLf & "2:1: Line of Text" & vbCrLf & "2:2: Line of: Text" & vbCrLf & "2:3: Line of Text:" & vbCrLf & "2:4 Line of Text" Dim myArr() As String Dim strChap As String myArr = Split(strText, vbCrLf) ReDim Preserve myArr(0 To UBound(myArr)) For i As Integer = 0 To UBound(myArr) For Each itm As String In myArr If itm.StartsWith(i & ":1") Then strChap = strChap & itm & vbCrLf myChap = Split(strChap, vbCrLf) ReDim Preserve myChap(0 To UBound(myChap)) End If Next Next Dim Vi As Integer Dim Ci As Integer Dim myCount As Integer Dim strVerse As String myCount = 0 Ci = myInt If myInt > UBound(myChap) Then Return Else myInt = myInt + 1 End If For Each itm As String In myArr If itm.StartsWith(Ci) Then myCount = myCount + 1 Vi = myCount If itm.StartsWith(Ci & ":" & Vi & ":") Then strVerse = strVerse & itm.Replace(":" & Vi & ":", ">" & Vi & ">") & vbCrLf End If End If Label2.Text = myCount Next If TextBox1.Text <> "" Then TextBox1.Text = TextBox1.Text & strVerse & vbCrLf Else TextBox1.Text = strVerse End If Label1.Text = UBound(myChap) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click cleanSweep() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myInt = 1 End Sub vbMarkO Quote Visual Basic 2008 Express Edition!
bri189a Posted September 25, 2005 Posted September 25, 2005 myInt = myChap.Length + 1 or myInt = myChap.Count + 1 Quote
vbMarkO Posted September 28, 2005 Author Posted September 28, 2005 Yep that did it vbMarkO Quote Visual Basic 2008 Express Edition!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.