Newbee question-VBForums
Results 1 to 3 of 3

Thread: Newbee question

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2011
    Posts
    2

    Newbee question

    Hello,

    I'm just starting work on a sliverlight project for the first time, its an existing project that has been worked on by a co-worker.

    Right so I to on of the first sections which is this:

    'Login the User and store the returned values
    dlgLoading.Show()
    src.LoginAsync(txtUserName.Text, txtPassword.Password)
    AddHandler src.LoginCompleted, AddressOf LoginClient


    Now my first through is that it should be this:

    'Login the User and store the returned values
    dlgLoading.Show()
    AddHandler src.LoginCompleted, AddressOf LoginClient
    src.LoginAsync(txtUserName.Text, txtPassword.Password)


    as I would think that you would always want to add the handler for the thread before running it. the code work either way. Its the same throughout the project.

    So my questions are:
    1. Am I right?
    2. Am I just being pedantic? Or could this course problems where the LoginCompleted event had been raised before the handler is added?

    Thanks,

    Ash

  2. #2
    PowerPoster
    Join Date
    May 2002
    Posts
    25,966

    Re: Newbee question

    It's possible... but the user would have to be an extremely fast typist, so it's an "unlikely" scenario. The reason is because the call is done asynch... so the thread gets spun up and sent off to do it's thing, mean while the addhandler gets called.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2011
    Posts
    2

    Re: Newbee question

    Thanks for confirming my suspisions,

    No typing involved, the
    dlgLoading.Show() is a wait icon,
    src.LoginAsync loges the user as login in

    its the same throughout the code and my fear is that in some instances the process 'may' complete before the relevant handlers have been added,

    Right some changes to be made then

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.