Results 1 to 6 of 6

Thread: [RESOLVED] Brains Not Working!

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Resolved [RESOLVED] Brains Not Working!

    A VB6 Form has a Label & a CommandButton. When this application is used in the trial version mode, users can use it only 5 times. As & when the application is run, the user should be shown how many times he has already used the application in the Label. The CommandButton should be visible only when the user runs the application for the sixth time otherwise the CommandButton should always be hidden. After the user has used it 5 times, he should be shown a message in the Label saying "Trial version expired" along with the CommandButton clicking which the application should terminate. I tried it this way:
    VB Code:
    1. Option Explicit
    2. Private Sub Form_Load()
    3.     Dim Count As Integer
    4.     Dim NumOfRuns As Integer
    5.    
    6.     NumOfRuns = Val(GetSetting("VBAPP", "TRIAL", "RUNS", "0"))
    7.     NumOfRuns = NumOfRuns + 1
    8.     SaveSetting "VBAPP", "TRIAL", "RUNS", NumOfRuns
    9.  
    10.     Count = GetSetting("VBAPP", "TRIAL", "RUNS")
    11.     If (Count = 1) Then
    12.         lblTrial.Caption = "You have used the trial version 1 time"
    13.     ElseIf (Count >= 2 And Count <= 5) Then
    14.         lblTrial.Caption = "You have used the trial version " & Count & " times"
    15.     ElseIf (Count > 5) Then
    16.         lblTrial.Caption = "Trial version expired"
    17.         cmdExit.Visible = True
    18.     End If
    19. End Sub
    But when the code is run from the IDE, the Form with the Label doesn't show up irrespective of the no. of times the application has been run. Where am I erring?

    Please note that the key gets created in the registry successfully.

    Thanks,

    Arpan


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  2. #2
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Brains Not Working!

    So the form with the label doesnt show? Try frmname.show then your label code

  3. #3

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: Brains Not Working!

    So the form with the label doesnt show? Try frmname.show then your label code
    Yeah.........Me.Show does solve the problem but why isn't the Form showing up without Me.Show?

    Thanks,

    Arpan


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  4. #4
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Brains Not Working!

    Have you tried stepping through the code to see where it is not doing what you expect?

  5. #5
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Brains Not Working!

    I have found that when you do some API's or call ActiveX's that call API's, the form events sometimes get delayed or events get ignored. You can test this by attempting to show an HourGlass while calling API's or ActiveX dll's. Sometimes the Hourglass refuses to show...

    That is why you need Me.Show.
    Last edited by randem; Dec 16th, 2005 at 03:37 PM.

  6. #6

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: Brains Not Working!

    I have found that when you do some API's or call ActiveX's that call API's, the form events sometimes get delayed or events get ignored. You can test this by attempting to show an HourGlass while calling API's or ActiveX dll's. Sometimes the Hourglass refuses to show...

    That is why you need Me.Show.
    Thanks Randem & thanks to others as well for your suggestions & ideas

    Regards,

    Arpan


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

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