Click here to Skip to main content
15,917,862 members
Home / Discussions / C#
   

C#

 
GeneralProcess.HasExited problems Pin
3Dizard1-Mar-05 9:44
3Dizard1-Mar-05 9:44 
GeneralRe: Process.HasExited problems Pin
Dave Kreskowiak1-Mar-05 10:14
mveDave Kreskowiak1-Mar-05 10:14 
GeneralRe: Process.HasExited problems Pin
3Dizard2-Mar-05 23:10
3Dizard2-Mar-05 23:10 
GeneralRe: Process.HasExited problems Pin
3Dizard3-Mar-05 0:14
3Dizard3-Mar-05 0:14 
GeneralBasic Thread Questions Pin
GhostsOfOrion1-Mar-05 8:29
GhostsOfOrion1-Mar-05 8:29 
GeneralRe: Basic Thread Questions Pin
S. Senthil Kumar1-Mar-05 8:58
S. Senthil Kumar1-Mar-05 8:58 
GeneralRe: Basic Thread Questions (LONG) Pin
GhostsOfOrion1-Mar-05 16:00
GhostsOfOrion1-Mar-05 16:00 
GeneralRe: Basic Thread Questions (LONG) Pin
S. Senthil Kumar1-Mar-05 17:04
S. Senthil Kumar1-Mar-05 17:04 

Maybe if I ask it like this… I new the first form of the app with Application.Run then that form news another form. In that second form I press a button that starts an AsyncCallback (from a socket). When that callback calls back it calls back to the (one and only) main thread. Or is it in a new thread?

I guess you got mixed up in terminologies, a callback can occur *on* a thread, it can't call a thread. You are confusing objects with threads, they are independent. For eg
<br />
class A<br />
{<br />
   public void SomeFunc()<br />
   {<br />
   }<br />
}<br />

Now, class A can be instantiated by the main thread and can be accessed from a different thread. Calling a method on the object from a different thread does not mean it is "called on" the main thread.
As for AsyncCallbacks, they are implemented using threads in the ThreadPool, so, to answer your question, no, async call backs don't occur on the main thread, they occur on a thread pool thread.

As for the second part, did you look into inheritance? It is a language feature specifically for the situation where you want a class to do a few operations and other classes to enhance/modify the operations of the original class. In your case, it would be something like
<br />
class MyClass<br />
{<br />
  //your basic methods<br />
}<br />
<br />
class Subclass1 : MyClass<br />
{<br />
   // Enhanced version<br />
}<br />

In the code above, Subclass1 contains all the data in MyClass, plus additional data that you've defined. If the above lines don't make any sense to you, I suggest you read a good "Object Oriented Programming" (OOP) book.


using mc = MyNamespace.MyMainClass;

This is only a shorthand for accessing MyMainClass, instead of typing using MyNameSpace at the top. It doesn't make any difference to the problem you're trying to solve. And you can access only static functions from mc.


Regards
Senthil
My Blog
GeneralRe: Basic Thread Questions (LONG) Pin
GhostsOfOrion2-Mar-05 4:17
GhostsOfOrion2-Mar-05 4:17 
GeneralInherited Forms in Compact Framework Pin
Tristan Rhodes1-Mar-05 7:59
Tristan Rhodes1-Mar-05 7:59 
GeneralOverriding Text in UserControl :confused: Pin
_eulogy_1-Mar-05 7:56
_eulogy_1-Mar-05 7:56 
GeneralRe: Overriding Text in UserControl :confused: Pin
spif20011-Mar-05 20:20
spif20011-Mar-05 20:20 
GeneralRe: Overriding Text in UserControl :confused: Pin
_eulogy_2-Mar-05 0:33
_eulogy_2-Mar-05 0:33 
GeneralForm Designer for Lightweight Framework Pin
Tristan Rhodes1-Mar-05 7:32
Tristan Rhodes1-Mar-05 7:32 
Generalupdating already opened window/form Pin
Adnan Siddiqi1-Mar-05 7:09
Adnan Siddiqi1-Mar-05 7:09 
GeneralExporting Crystal Reports To PDF Errors Pin
Khang Nguyen1-Mar-05 7:03
Khang Nguyen1-Mar-05 7:03 
GeneralRe: Exporting Crystal Reports To PDF Errors Pin
Raganar1-Mar-05 7:59
Raganar1-Mar-05 7:59 
GeneralRe: Exporting Crystal Reports To PDF Errors Pin
Khang Nguyen1-Mar-05 8:24
Khang Nguyen1-Mar-05 8:24 
GeneralAttributes property Pin
MyThread1-Mar-05 6:19
MyThread1-Mar-05 6:19 
GeneralRe: Attributes property Pin
Robert Rohde1-Mar-05 6:51
Robert Rohde1-Mar-05 6:51 
GeneralRe: Attributes property Pin
MyThread1-Mar-05 6:58
MyThread1-Mar-05 6:58 
GeneralForms in DLL's in .Net Lightweight Pin
Tristan Rhodes1-Mar-05 5:59
Tristan Rhodes1-Mar-05 5:59 
GeneralUpdate Pin
Tristan Rhodes1-Mar-05 6:03
Tristan Rhodes1-Mar-05 6:03 
GeneralMore stuff that cause LightweightFramework to crash. Pin
Tristan Rhodes1-Mar-05 6:39
Tristan Rhodes1-Mar-05 6:39 
GeneralRe: More stuff that cause LightweightFramework to crash. Pin
Dave Kreskowiak1-Mar-05 7:22
mveDave Kreskowiak1-Mar-05 7:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.