Results 1 to 7 of 7

Thread: [RESOLVED] [2005] RichTextbox.Lines problem Ignoring first line?

  1. #1

    Thread Starter
    Fanatic Member Lerroy_Jenkins's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    661

    Resolved [RESOLVED] [2005] RichTextbox.Lines problem Ignoring first line?

    vb Code:
    1. Private Sub DSAddUsersList()
    2.         Dim EndProd As String
    3.         Dim UserName As String
    4.         Dim HomePath As String
    5.         Dim NewLines As New List(Of String)
    6.         Dim myquote As String = """"
    7.  
    8.         If Me.rtbMain.Lines.GetUpperBound(0) > 0 Then
    9.             For Each line As String In Me.rtbMain.Lines
    10.                 UserName = line
    11.                 HomePath = tboHomePath.Text & "\" & UserName
    12.  
    13.                 EndProd = "DSADD User " & myquote & "cn=test2,ou=Lerroystest" & myquote & ""
    14.                 NewLines.Add(EndProd)
    15.             Next
    16.             Me.rtbMain.Lines = NewLines.ToArray
    17.         Else
    18.             MsgBox("There is no data inside the textbox for you to manipulate!")
    19.         End If
    20.  
    21.     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).
    Lerroy

    "η β π", or "Eta Beta Pi" (Eat A Better Pie)

    01001000
    01000101
    01001100
    01010000


    My Own Code - WordCounter

    Useful Forum Links -Reputation - What is it?

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    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?

  3. #3

    Thread Starter
    Fanatic Member Lerroy_Jenkins's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    661

    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.
    Lerroy

    "η β π", or "Eta Beta Pi" (Eat A Better Pie)

    01001000
    01000101
    01001100
    01010000


    My Own Code - WordCounter

    Useful Forum Links -Reputation - What is it?

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    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
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  5. #5

    Thread Starter
    Fanatic Member Lerroy_Jenkins's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    661

    Re: [2005] RichTextbox.Lines problem Ignoring first line?

    Yes, I just tried (1) and i get

    "Array does not have that many dimensions"
    Lerroy

    "η β π", or "Eta Beta Pi" (Eat A Better Pie)

    01001000
    01000101
    01001100
    01010000


    My Own Code - WordCounter

    Useful Forum Links -Reputation - What is it?

  6. #6

    Thread Starter
    Fanatic Member Lerroy_Jenkins's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    661

    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!
    Lerroy

    "η β π", or "Eta Beta Pi" (Eat A Better Pie)

    01001000
    01000101
    01001100
    01010000


    My Own Code - WordCounter

    Useful Forum Links -Reputation - What is it?

  7. #7
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [RESOLVED] [2005] RichTextbox.Lines problem Ignoring first line?

    Me.rtbMain.lines.GetUpperBound(0) >= 0
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width