You
You

Reputation: 47

update richtextbox from vb class

I am running a function through a class and I want to output the results to a RichTextBox on my MainForm.

memSearch.execute(inpMemRows, outMemRows, Mpi.[GetType].ASENTITY, Mpi.SearchType.ASMEMBER)

Dim sb As New StringBuilder()
Dim iter As Mpi.RowIterator = outMemRows.rows()

While iter.hasMoreRows()
    Dim row As Mpi.MemRow = DirectCast(iter.nextRow(), Mpi.MemRow)
    MainForm.RichTextBox1.Text = row.getString("memhead")
End While

how can I accomplish this?

Currently, I am using MessageBox and obviously I don't want that. So I know the code is working where I need the data.

But how do I get the data to the RichTextBox?

Upvotes: 0

Views: 98

Answers (1)

Deja Vu
Deja Vu

Reputation: 413

If you mean that you want to put all the rows in the RichTextBox then change this line:

MainForm.RichTextBox1.Text = row.getString("memhead")

To be:

MainForm.RichTextBox1.Text &= row.getString("memhead") & vbCrLf

Which is equivalent to:

MainForm.RichTextBox1.Text = MainForm.RichTextBox1.Text & row.getString("memhead") & vbNewLine

Upvotes: 1

Related Questions