vbMarkO Posted September 30, 2005 Posted September 30, 2005 Here is my code what I am trying to do is manipulate strings with an array like this chpArr() contains a smaple of the following text 1-10 2-29 3-24 4-21 5-21 This represents the Book of 1 John where chapter 1 has 10 verses and 2 - 29 verses and so on with my code I am wanting to get the verses my problem with what I was trying is that with the single digit chapters it worked great but with 10 and above NOPE I know its because of how I was trying to trim and such Help appreciated Heres the code Dim vrs1 As String verseCombo.Items.Clear() If verseCombo.Items.Count <= -1 Then MsgBox("You must first choose a Book and chapter first!!!") Return Else For i As Integer = 1 To UBound(chpArr) + 1 ' chpArr has count of chapters so in the case of the above example 1 John there would be only 5 ' with the five it worked fine but add one of the larger books it doesnt If chapCombo.Text = i Then vrs1 = chpArr(i - 1).Trim("-") vrs1 = vrs1.Substring(1) For iv As Integer = 1 To vrs1 verseCombo.Items.Add(iv) Next End If Next End If vbLarKO Quote Visual Basic 2008 Express Edition!
Administrators PlausiblyDamp Posted September 30, 2005 Administrators Posted September 30, 2005 One possible problem is the line vrs1 = vrs1.Substring(1) that will only work with single numbers, you will need to take into account the length of the string version of the chapter number. Try something like vrs1=vrs1.Substring(i.ToString().Length) haven't tested it but it should be close to what you need. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
vbMarkO Posted September 30, 2005 Author Posted September 30, 2005 Yep that did the trick This is [RESOLVED] Thank You 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.