|
-
Dec 16th, 2005, 02:36 PM
#1
Thread Starter
Frenzied Member
[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:
Option Explicit
Private Sub Form_Load()
Dim Count As Integer
Dim NumOfRuns As Integer
NumOfRuns = Val(GetSetting("VBAPP", "TRIAL", "RUNS", "0"))
NumOfRuns = NumOfRuns + 1
SaveSetting "VBAPP", "TRIAL", "RUNS", NumOfRuns
Count = GetSetting("VBAPP", "TRIAL", "RUNS")
If (Count = 1) Then
lblTrial.Caption = "You have used the trial version 1 time"
ElseIf (Count >= 2 And Count <= 5) Then
lblTrial.Caption = "You have used the trial version " & Count & " times"
ElseIf (Count > 5) Then
lblTrial.Caption = "Trial version expired"
cmdExit.Visible = True
End If
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?
-
Dec 16th, 2005, 02:57 PM
#2
Re: Brains Not Working!
So the form with the label doesnt show? Try frmname.show then your label code
-
Dec 16th, 2005, 03:23 PM
#3
Thread Starter
Frenzied Member
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?
-
Dec 16th, 2005, 03:27 PM
#4
PowerPoster
Re: Brains Not Working!
Have you tried stepping through the code to see where it is not doing what you expect?
-
Dec 16th, 2005, 03:31 PM
#5
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.
-
Dec 16th, 2005, 03:46 PM
#6
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|