teixeira Posted October 12, 2005 Posted October 12, 2005 Hi, This is a little about my last post, but i'll ask for help in other terms. Basically, i've a Terminal that reads the COM port and i'm using VS2005 Team System Beta2 an VB.NET, i'm making all ok about the settings of the serial port and so on but i cannot show the received text into a textbox. Problem:Cross-Thread.... can not access to the textbox because in a diferent thread... How can i solve this and show the received text without any problem, i thought o could solve this using the delegates but i was unable to do that ( that was the objective of my last thread ) any help? I saw an example but in C#, that invokes the method AppendText() of the textbox and it was ok but i couldn't solve this in VB.NET. Thanks, Best Regards, Teixeira Quote
Nate Bross Posted October 12, 2005 Posted October 12, 2005 You may want to look at this example. http://zone13.net/zone13/default.asp?PageAction=TECHTALK&TechID=539. It uses a class to pass a variable to a thread. You could change the integer value to a 'ByRef' of your textbox like this. 'pseudocode 'FORM Dim MyClass as New ExampleClass(MyTextBox) 'CLASS 'Init Public TextBox1 as TextBox Sub New(ByRef tb as TextBox) TextBox1 = tb End Sub 'Use Sub ThreadProcessLoop() do forever TextBox1.Text &= MyValueMadeInThisThread loop End SUb Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.