Click here to Skip to main content
15,920,438 members
Home / Discussions / C#
   

C#

 
AnswerRe: How do I hide a property from the property window? Pin
Andy Smith30-Jul-02 19:42
Andy Smith30-Jul-02 19:42 
GeneralRe: How do I hide a property from the property window? Pin
Ray Cassick31-Jul-02 2:41
Ray Cassick31-Jul-02 2:41 
GeneralRe: How do I hide a property from the property window? Pin
Ray Cassick31-Jul-02 18:49
Ray Cassick31-Jul-02 18:49 
GeneralRe: How do I hide a property from the property window? Pin
Nathan Blomquist1-Aug-02 1:27
Nathan Blomquist1-Aug-02 1:27 
QuestionBug in VS.NET? Pin
Johnny Zee30-Jul-02 10:01
sussJohnny Zee30-Jul-02 10:01 
AnswerRe: Bug in VS.NET? Pin
Johnny Zee1-Aug-02 2:49
sussJohnny Zee1-Aug-02 2:49 
GeneralThe Web Service FREEZE the App Pin
laphijia30-Jul-02 9:05
laphijia30-Jul-02 9:05 
GeneralRe: The Web Service FREEZE the App Pin
James T. Johnson30-Jul-02 16:56
James T. Johnson30-Jul-02 16:56 
What you are seeing is that all the work is being done on one thread, including all the waiting that you have to do while you wait for the webservice to respond.

The solution is to use an Async method or a separate thread. The Async method will use a separate thread but it takes care of all the work for you; while you have to do all the work to use a thread yourself.

If I remember correctly the code that the "Add Web Reference" option generates includes some Async methods. The Async methods begin with Begin and End followed by the name of the method.

Using a method from the CodeProject webservice

ArticleBrief[] GetLatestArticleBrief(int NumArticles);

The Async versions of this method are:
IAsyncResult BeginGetLatestArticleBrief(int NumArticles, AsyncCallback callback, object asyncState); and
ArticleBrief[] EndGetLatestArticleBrief(IAsyncResult asyncResult);

Typical usage is as such

IAsyncResult iar = BeginGetLatestArticleBrief(numArticles, null, null);
 
// Later on
if( iar.IsCompleted )
{
  articleBriefs = EndGetLatestArticleBrief(iar);
}
else
{
 // do something else
}


Since you wouldn't be doing anything else while the user is logging in I would do this:

IAsyncResult iar = BeginLoginUser(username, password, null, null);
 
while( !iar.IsCompleted )
{
  Application.DoEvents(); // Let the message pump do some work
}
 
// Continue as before
This is only a brief intro and a limited way of doing things, MSDN contains an entire section on Asynchronous programming which you should read before going much further.

If you use the MSDN that came with VS.NET I found the topic by going to the following nodes: Visual Studio.NET -> .NET Framework -> Programming with the .NET Framework -> Including Asynchronous Calls

HTH,

James
"Java is free - and worth every penny." - Christian Graus
GeneralLate binding to objects... Pin
Ryan Cromwell30-Jul-02 7:47
Ryan Cromwell30-Jul-02 7:47 
GeneralRe: Late binding to objects... Pin
Andy Smith30-Jul-02 8:34
Andy Smith30-Jul-02 8:34 
GeneralRe: Late binding to objects... Pin
Ryan Cromwell30-Jul-02 8:44
Ryan Cromwell30-Jul-02 8:44 
GeneralRe: Late binding to objects... Pin
Eric Gunnerson (msft)30-Jul-02 8:54
Eric Gunnerson (msft)30-Jul-02 8:54 
GeneralRe: Late binding to objects... Pin
Ryan Cromwell30-Jul-02 9:04
Ryan Cromwell30-Jul-02 9:04 
GeneralRe: Late binding to objects... Pin
Ryan Cromwell30-Jul-02 9:33
Ryan Cromwell30-Jul-02 9:33 
GeneralRe: Late binding to objects... Pin
Eric Gunnerson (msft)30-Jul-02 9:49
Eric Gunnerson (msft)30-Jul-02 9:49 
GeneralRe: Late binding to objects... Pin
leppie31-Jul-02 2:12
leppie31-Jul-02 2:12 
GeneralRe: Late binding to objects... Pin
Eric Gunnerson (msft)31-Jul-02 6:48
Eric Gunnerson (msft)31-Jul-02 6:48 
QuestionWhy does OleDbDataAdaptor do this? Pin
Zombies with Coffee, LLC30-Jul-02 5:51
professionalZombies with Coffee, LLC30-Jul-02 5:51 
AnswerRe: Why does OleDbDataAdaptor do this? Pin
Zombies with Coffee, LLC30-Jul-02 6:18
professionalZombies with Coffee, LLC30-Jul-02 6:18 
Generalimplicit cast Pin
Christian Graus30-Jul-02 4:23
protectorChristian Graus30-Jul-02 4:23 
GeneralRe: implicit cast Pin
Nish Nishant30-Jul-02 5:23
sitebuilderNish Nishant30-Jul-02 5:23 
GeneralRe: implicit cast Pin
Christian Graus30-Jul-02 12:27
protectorChristian Graus30-Jul-02 12:27 
GeneralRe: implicit cast Pin
James T. Johnson30-Jul-02 16:22
James T. Johnson30-Jul-02 16:22 
GeneralRe: implicit cast Pin
Christian Graus30-Jul-02 17:17
protectorChristian Graus30-Jul-02 17:17 
GeneralDLL Hell Pin
gekoscan30-Jul-02 2:38
gekoscan30-Jul-02 2:38 

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.