Solved

how to pass data between forms using delegates with vb.net

Posted on 2013-01-09
5
928 Views
Last Modified: 2013-01-09
I would like to know if how to read data from other form when Using a thread

this is my code:
        trd = New Thread(AddressOf analisis)
        trd.IsBackground = True
        trd.Start()

Open in new window


sub analisis()
        Dim test As Double
        test  = cdbl(secondform.example.text)
end sub

Open in new window


Give me this error I use the thread when test try to read the value from the textbox "example"
error
but I if remove the thread test obtain without problems the value from example

What I need to do to read the value of the the textbox example using the thread????
0
Comment
Question by:altariamx2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 38761195
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38761307
You can READ a controls value from another thread no problem.  I believe your error is because the value in the TextBox cannot be converted to a Double.  It is either blank or something that is not a number representing a Double.  Use Double.TryParse() instead...
0
 

Author Comment

by:altariamx2003
ID: 38761479
thanks for answer Idle, but that was is not the problem

when I tried to assign the value of the textbox example inside the thread show me the error that I post

but outside the thread everything works great

I use the solution of Codecruiser


thanks anyway
0
 

Author Closing Comment

by:altariamx2003
ID: 38761481
this is the solution

thanks!!!
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38761657
The error you posted was indeed associated with the conversion of a string to a double, and had nothing to do with threading.  =)

The code you posted was reading from the control, which does not create an error.

Writing to the control from the thread, which you did not have in your posted code, would create a different exception that can be solved with Invoke() and Delegates.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question