[RESOLVED] [2005] RichTextbox.Lines problem Ignoring first line?
vb Code:
Private Sub DSAddUsersList()
Dim EndProd As String
Dim UserName As String
Dim HomePath As String
Dim NewLines As New List(Of String)
Dim myquote As String = """"
If Me.rtbMain.Lines.GetUpperBound(0) > 0 Then
For Each line As String In Me.rtbMain.Lines
UserName = line
HomePath = tboHomePath.Text & "\" & UserName
EndProd = "DSADD User " & myquote & "cn=test2,ou=Lerroystest" & myquote & ""
NewLines.Add(EndProd)
Next
Me.rtbMain.Lines = NewLines.ToArray
Else
MsgBox("There is no data inside the textbox for you to manipulate!")
End If
End Sub
This basically (When the "EndProd =" is finished it will manipulate all sorts of text boxes etc I have already pre-populated.
But if I type something into the first line of the richtextbox and then press the button (which then calls this function).
Re: [2005] RichTextbox.Lines problem Ignoring first line?
Why are you saying it ignores the 1st line? What is the expected result from running that code? And what is the actual result you get?
Re: [2005] RichTextbox.Lines problem Ignoring first line?
Sorry, say I type into the richtextbox
FredBlogs
I would expect (When the code string EndProd is finished) for the code to manipulate this name.
At current it does nothing
If I have
Fredblogs
fredblogs
Then it manipulates the code how I wanted it.
Re: [2005] RichTextbox.Lines problem Ignoring first line?
Is rtbMain.Lines zero based? Put break here and look at values
If Me.rtbMain.Lines.GetUpperBound(0) > 0 Then
Re: [2005] RichTextbox.Lines problem Ignoring first line?
Yes, I just tried (1) and i get
"Array does not have that many dimensions"
Re: [RESOLVED] [2005] RichTextbox.Lines problem Ignoring first line?
Found it
Me.rtbMain.lines.GetUpperBound(0) > -1 then
I forgot the first line is classed as 0. Not 1!
Re: [RESOLVED] [2005] RichTextbox.Lines problem Ignoring first line?
Me.rtbMain.lines.GetUpperBound(0) >= 0