Results 1 to 4 of 4

Thread: [RESOLVED] CF 3.5 - Alternative to Shown event ?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2012
    Location
    Toulouse, France
    Posts
    21

    Resolved [RESOLVED] CF 3.5 - Alternative to Shown event ?

    Hi there,

    I'm developping an application for Pocket PC but I don't have the Shown event for a form.
    During FORM_A loading, I check some values and sometimes I need to open FORM_B.

    But FORM_B is opened before FORM_A, so I can't see it. And I don't want my users to click on a button to open FORM_B, I want this check to be automatically done by my program.
    My solution would be to use FORM_A.Shown() event, but I don't get it.. Maybe because I'm programming for Smart Devices?

    Is there any alternative, tricks to simulate it ?

    Thank you

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: CF 3.5 - Alternative to Shown event ?

    The Shown event hasn't actually been supported from the beginning of .NET. It was only introduced in .NET 2.0 I think. Before that we had to use the Activated event and use our own Boolean flag to differentiate between the very first instance of that event, which occurs when it is first displayed, and any subsequent instances. You can do exactly the same.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2012
    Location
    Toulouse, France
    Posts
    21

    Re: CF 3.5 - Alternative to Shown event ?

    Thank you for your answer and explanation,
    I try to initialize a glob boolean variable to False during load event.

    Then in validated event I did like :
    Code:
    Class FORM_A
    {
    Dim myVar as Boolean = False // I tried this the 1st time 
    sub FORM_Load().Load
    {
        myVar = False // I tried this the 2nd time
    }
    
    
    sub FORM_Activated().Activated
    {
         If myVar = False then
              FORM_B.Show
              myVar = True
         End If
    }
    }
    Nothing seems to happen... FORM_B doesn't show itself... I replace FORM_B.Show by a Msgbox and it popup many times before my app crashs.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2012
    Location
    Toulouse, France
    Posts
    21

    Resolved Re: CF 3.5 - Alternative to Shown event ?

    I think I've found a solution which seems to work.

    To open a new form during the loading of an other form, I replace .Show() to .ShowDialog().

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width