How can i access form controls in VB.NET

  • Thread starter Thread starter Mamatha
  • Start date Start date
M

Mamatha

Hi

I have a small application in VB.NET,it consists of one
form,one class and one module.I have declared one thread
globally in module to execute the function in the form.I
started that thread in a class.
In that function of the form i had wrote code like that :
Open a text file and reading contents from that file.
Now i want to display that content into a text control of
the form.But i was unable to display that.
I don't know the reason why its happend like that.
I want to display that text of the file into the
textcontrol of the form.
If anybody knows the solution please help me,this is very
urgent need for me.
Thanks in advance.

Mamatha
 
Mamatha said:
I have a small application in VB.NET,it consists of one
form,one class and one module.I have declared one thread
globally in module to execute the function in the form.I
started that thread in a class.
In that function of the form i had wrote code like that :
Open a text file and reading contents from that file.
Now i want to display that content into a text control of
the form.But i was unable to display that.
I don't know the reason why its happend like that.

You cannot access instance members of Windows Forms controls from another
thread than the thread they were created on (the main UI thread) directly.

Multithreading + Windows Forms:

<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms06112002.asp>
<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms08162002.asp>
<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms01232003.asp>

<URL:http://www.devx.com/dotnet/Article/11358/>

<URL:http://msdn.microsoft.com/library/e...SystemWindowsFormsControlClassInvokeTopic.asp>

Multithreading in Visual Basic .NET (Visual Basic Language Concepts)
<URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconthreadinginvisualbasic.asp>

Sample:

<URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top