how do I "transfer" lines?

I need to transfer the upper line listed in a Richtextbox to an ordinary textbox. But only the first line none of the others. How do I do that?

Plz advice

Comments

  • Hi,

    Here's a possibility. I have a text box called txt and a RichTextBox called rtb.

    [code]
    Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click
    Dim sText As String
    'Check that something has been entered
    If rtb.Text <> String.Empty Then
    Try
    'Look for Enter keystroke chr(10)
    sText = rtb.Text.Substring(0, rtb.Text.IndexOf(Chr(10)))
    txt.Text = sText
    Catch errArg As ArgumentOutOfRangeException
    'No second line
    txt.Text = rtb.Text
    End Try
    End If
    End Sub
    [/code]

    Hope that helps.
    Cheers,

    Chris

    : I need to transfer the upper line listed in a Richtextbox to an ordinary textbox. But only the first line none of the others. How do I do that?
    :
    : Plz advice
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion