Hello.
I'm not very familiar with RichTextBox so I don't know if it can do what I'm thinking.

I have 2 textbox, Quantity and Type. What I want is, when type in both, and click Save, it will save in the RichTextBox. Then click Clear, the text in both textbox will clear but no in the RichTextBox. What I want to know is, can it has column, Quantity is 1st, Type is 2nd? How do I make it to save in new line?

I've tried and got it to save in RichTextBox when the textbox is cleared but not the new line and column.

Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
        For Each IndividualCoffeeSale As CoffeeSale In TransactionCoffeeSale
            If IndividualCoffeeSale.QuantityString <> "" Then
                RichTextBox1.Text = IndividualCoffeeSale.QuantityString
            End If
        Next
    End Sub

Need your expertise. Thank you. :)

Recommended Answers

All 2 Replies

See if this helps.

If Not RichTextBox1.Text = "" Then '// if Not empty, add a New line and content.
            RichTextBox1.Text &= vbNewLine & TextBox1.Text & " - " & TextBox2.Text
        Else '// if empty, just add content.
            RichTextBox1.Text = TextBox1.Text & " - " & TextBox2.Text
        End If
        '// Clear TextBoxes.
        TextBox1.Clear() : TextBox2.Clear()

It worked! Thank you so much! >_<

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.