Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

reg code question

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-30-2008, 08:35 AM
Junior Member
 
Join Date: May 2007
Posts: 36
Default reg code question

any idea why I getting an error on this code and how to complete it, thanks !!!

Sub Globals
'Declare the global variables here.
regdt=Date(Now)
rc=0
End Sub
Sub App_Start
Form1.Show
reg
End Sub
Sub reg
Dim regexp
ErrorLabel(Err1)
If FileExist ("c:\windows\clrbn.txt") = true Then
FileOpen (c1,"c:\windows\clrbn.txt",cRead)
r = FileRead (c1)
FileClose (c1)
Else
regdt=Date(Now)
FileOpen (c1,"c:\windows\clrbn.txt",cWrite)
FileWrite (c1,regdt)
FileClose (c1)
End If
textbox1.Text=r ' Displays Registration Date
textbox3.text=Date(Now) ' Displays Today Date
rd=DateAdd(r, 0, 1, 0)'sets reg duration (Ticks, Years, Months, Days)for one month
textbox2.text=rd ' Displays Registration Expires Date
dn=Date(Now)
If dn > rd Msgbox("Registration Expired, Contact Support for Registered Version, Contact scott93727@aol.com"):rc=1 ' if date now later then regdate by 1 month
Goto sed
err1:
Msgbox("Registration Error, Contact Support, scott93727@aol.com")
sed:
'if rc=1 then (Control code (what to disable after reg. expires))
End Sub
Reply With Quote
  #2 (permalink)  
Old 05-30-2008, 09:02 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

You are missing a "Then" in the "IF dn > rd" statement on line 28. Also the statement "rc=1" on the same line will not execute (but the compiler won't error it) as a single line IF only executes one statement. I would strongly advise against ever using a single line IF statement. I always use IF ... End If as I think it makes things much clearer and avoids bugs.
Reply With Quote
  #3 (permalink)  
Old 05-30-2008, 12:24 PM
Junior Member
 
Join Date: May 2007
Posts: 36
Default figured it out, wil be uploading registration form soon.

Sub reg ' complete registration manager in one sub
regdt=Date(Now)
ErrorLabel(Err1)
If FileExist ("c:\windows\clrbn.txt") = true Then 'opens registration file information
FileOpen (c1,"c:\windows\clrbn.txt",cRead)
r = FileRead (c1)
FileClose (c1)
Else
regdt=Date(Now)
FileOpen (c1,"c:\windows\clrbn.txt",cWrite) 'creates registration file information
FileWrite (c1,regdt)
FileClose (c1)
End If
textbox1.Text=r ' Displays Registration Date
textbox3.text=Date(Now) ' Displays Today Date
x = DateParse (r) ' converts install date to ticks
rd=DateAdd(x, 0, 1, 0)'sets reg duration in ticks (Ticks, Years, Months, Days)for one month
textbox2.text=Date(rd) ' converts ticks to date and Displays Registration Expires Date
td=Now ' todays date in ticks
textbox4.text=rd 'displays regticks
textbox5.text=rd 'dis[lays expticks
textbox6.text=td 'displays todayticks
If rd < td Then Msgbox("Registration Expired, Contact Support for Registered Version, Contact scott93727@aol.com")' if date now later then regdate by 1 month
If rd < td Then Goto regctl Else Goto regend
Goto regend
err1:
Msgbox("Registration Error, Contact Support, scott93727@aol.com")
regctl:
Form1.Text = "Registration expired, Contact Support"
textbox7.Text="Registration expired...Contact Support at scott93727@aol.com"
'rc=1 (Declare global rc=0) for Control code (what to disable after reg. expires))
' example if rc = 1 then close form1
Goto rged
regend:
Form1.Text = "Registration Period Active..."
textbox7.Text=" Registration Period Active..."
rged:
End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Code giannimaione Questions (Windows Mobile) 5 06-01-2008 06:03 PM
Petite question sur la conversion d'un code VB6 en Basic4ppc GallyHC French Forum 11 05-27-2008 01:25 PM
Where is Form Code? enonod Questions (Windows Mobile) 2 10-13-2007 12:04 PM
Help with code cdeane Questions (Windows Mobile) 9 09-22-2007 04:30 PM
Code files jerryjukem Questions (Windows Mobile) 1 07-28-2007 06:57 PM


All times are GMT. The time now is 09:41 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0