|
-
Apr 4th, 2008, 03:44 AM
#1
Thread Starter
Fanatic Member
[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).
-
Apr 4th, 2008, 07:31 AM
#2
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?
-
Apr 4th, 2008, 08:03 AM
#3
Thread Starter
Fanatic Member
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.
-
Apr 4th, 2008, 08:20 AM
#4
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
-
Apr 4th, 2008, 08:22 AM
#5
Thread Starter
Fanatic Member
Re: [2005] RichTextbox.Lines problem Ignoring first line?
Yes, I just tried (1) and i get
"Array does not have that many dimensions"
-
Apr 4th, 2008, 08:33 AM
#6
Thread Starter
Fanatic Member
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!
-
Apr 4th, 2008, 09:29 AM
#7
Re: [RESOLVED] [2005] RichTextbox.Lines problem Ignoring first line?
Me.rtbMain.lines.GetUpperBound(0) >= 0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|