Sending data to a textbox on another form

johnadonaldson

Well-known member
Joined
Nov 9, 2005
Messages
48
Programming Experience
10+
I know this sounds like a newbi question but I am modifying a existing VB.NET program. I want to take the existing output to a textbox on frmMain and reroute it to a textbox on a moduless form. I have seen examples of getting data from a second form and displaying it in frmMain, but for the other way around. I tried to reverse the example, but all that happens is the textbox on the second forum is no longer visiable. This happens when I set

Public Shared TermRx as textbox

If I do this the textbox is not displayed either in the editor or runtime.

Under the old VB 6.0 all I need was to

NewForm.TermRx.text = <data>

So I tried this approach. Syntax is correct but no data appears in Modless form.

PrivateSub WriteMessage(ByVal message AsString)
Dim fOpt As New Terminal

Me.TextBox2.Text += message + vbCrLf
fOpt.TermRx.Text += message + vbCrLf

TextBox2.SelectionStart = TextBox2.Text.Length
fOpt.TermRx.SelectionStart = fOpt.TermRx.Text.Length

EndSub


 
Last edited:
Back
Top