Thursday, April 21, 2011

How to make TRIAL version( Date based) section in Window Application Software


RAM RAM Friends
How to make TRIAL version (Date based) section in Window Application Software

Hi Friends, when I used to learn how to make complete software during my MCA, I face lot of problem to find a way to provide Trial version option in my projects so that they would run in trial mode for some time/days & after that they need registration to continue.

Now I am providing here a way to resolve such problem by one way out of many possible ways & this is
Trial Version (Date based). 
  1. First I had mentioned the algo to explain its working then
  2. I gave code to implement it in VB6.0 &
  3. Then code in VB.NET

 Here it goes

1. ALGO

({[EVALUATION/DEMO/TRIAL version Management Plan]})

  • Return “AK_Expired” key from registry
  • If AK_Expired=false or 1 (or any other value indicating evaluation expired)
    • Disable evaluation button
    • Show message “Evatuation period expired etc”
  • Else //if AK_Expired=true or 0 (or any other value indicating evaluation not expired)
    •  Search AK_StartDt.akk (or any other name you like) present in computer “Windows” Directory (or any other place in computer you like)
    • If AK_StartDt.akk file not present in computer “Windows” directory
      • Create new file AK_StartDt.akk in computer “Windows” Directory & write current date in this file.
      • Create another file AK_EndDt.akk in computer “Window” directory & write new date which is equal to (current date + 31 days).
      • Enter current date in “AK_LastUsedDt” key in registry
      • Display label “Demo Version........ Just for 31 Days.”
      • Enable evaluation button.
    • Else if AK_StartDt.akk file present in computer “Windows” Directory
      • Return FirstDate from AK_StartDt.akk file
      • Return LastDate from AK_EndDt.akk file
      • Return LastUseDate from “AK_LastUsedDt” key in registry

      • //first level of security for evaluation
      • If LastUseDate=” ”
        • enter current date in “AK_LastUsedDt” key in registry
      • Else if LastUseDate is a date
        • if LastUseDate>current date
          • display message “Evaluation Expired …. Contact ABC”
          • disable “Evaluation” button
          • enter False or 1 in “AK_Expired” key in registry
        • else  //if LastUseDate<=current date
          • enter current date in “AK_LastUsedDt” key in registry
        • end if
      • Else // if LastUseDate is other than date or “ ”
        • display message “Evaluation Expired …. Contact ABC”
        • disable “Evaluation” button
        • enter False or 1 in “AK_Expired” key in registry
      • End if  // If LastUseDate=” ”

      •  //Second Level of security for evaluation
      • If currend date < FirstDate  or current date >LastDate
        • display message “Evaluation Expired …. Contact ABC”
        • disable “Evaluation” button
        • enter False or 1 in “AK_Expired” key in registry
      • Else
        • Show message “only (31-(current date-FirstDate)) days are remaining”
      • End if  // If current date < FirstDate  or current date >LastDate
    • End if   // If AK_StartDt.akk file not present in computer “Windows” directory
  •  End if  // If AK_Expired=false or 1

 Note:
  • 1. I have used following keys to store information in Registry
    • 1. AK_Expired   2. AK_LastUsedDt
  • 2. I have used following files to store information in Windows directory
    • 1. AK_StartDt.akk          2. AK_EndDt.akk
  • 3        To provide more security, you can use any other location or any other keyname/file name & write encrypted information there.
DRAWBACKS
  • As almost all things in universe have few or more drawbacks, this algo also has one drawbacks
    • If after installing & using your software at least one time, user changes his/her system date & then open your software then your software shows 
      • "Trial version expired..............."
  • SOLUTION ---------
    • Since there is no proper solutions, but you can make a small exe which would erase all/few of the evaluation securities or correct them to activate your software in evaluation mode.
      • since one can use the same exe more than one time, so to protect it, you can use either pwd (hard coded or dynamic(based on current date,time,etc), or do some coding so that this file execute only once in its life cycle etc.
    • since sometime after using your evaluation version, user can ask you after some time(days/months/yrs) that he want to use it again or there may be some other porblem, the above solution would be useful in such cases also.


VB6.0 Code to implement the above algo


  • ‘ Below is the api function must write in module1 or somewhere else
    • Public Declare Function GetWindowsDirectory Lib "kernel32.dll" _
    • Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Integer) As Long 
  • Note:-----Below procedure must be put in either startup procedure of project or in load event of evaluation form 
  • ‘get the Window directory path
  •  
  • strTemp = String$(255, Chr(0))
  • lngRetVal = GetWindowsDirectory(strTemp, Len(strTemp))
  • strTemp = Replace(strTemp, Chr(0), "")
  •  
  • ‘Get Hard drive serial no to act as Project password. You can encrypt it to make software more secure
  •  '--Begin-------how to get Hard drive serial no via vb6------------------
  • Dim FS As FileSystemObject
  • Set FS = New FileSystemObject
  • Dim d As Drive
  • Set d = FS.GetDrive("C:")
  • GValidNo = Abs(d.SerialNumber)
  •  '--End-------how to get Hard drive serial no via vb6------------------ 
  • ‘Get Project password (here Hard drive Serial No) from registry
  • mactno = GetSetting("ArunKakkarCompany ", " AK_Proj1", "AK_MacPwd")
  •  
  • ‘Check if software is registered or not
  • If mactno = GValidNo Then
    • ‘below are the various controls on the evaluation form
    • Me.Frame1.Visible = False
    • Me. lblMsg.Visible = True
  • Else 
    • If GetSetting("ArunKakkarCompany ", " AK_Proj1", " AK_Expired ") <> "1" Then
      • If FS.FileExists(strTemp & "\ AK_StartDt.akk ") Then
        • Fl = FreeFile 
        • ‘here reading date from file which(date) is stored as day in 1st line, ‘month in 2nd line & year in 3rd line of file to make a small kind of encryption & converting it into d/m/yyyy format          
        • ‘open file in read only mode  
        • Open strTemp & "\ AK_StartDt.akk " For Input As #Fl
          • S1 = ""
          • Do While Not EOF(Fl)                  
            • ‘read one line from file & store value in s
            • Input #Fl, S
            • If S1 = "" Then
              • S1 = S
            • Else
              • S1 = S1 & "/" & S
            • End If
          • Loop
        • Close #Fl
        • S1 = Format(S1, "D/M/YYYY")
        • Fl = FreeFile
        • Open strTemp & "\ AK_EndDt.akk " For Input As #Fl
          • S2 = ""
          • Do While Not EOF(Fl)
            • Input #Fl, S
            • If S2 = "" Then
              • S2 = S
            • Else
              • S2 = S2 & "/" & S
            • End If
          • Loop
        • Close #Fl
        • S2 = Format(S2, "D/M/YYYY")
        • LastUsedDate = GetSetting("ArunKakkarCompany ", "AK_Proj1", "AK_LastUsedDt")
        • If LastUsedDate = "" Then
          • SaveSetting " ArunKakkarCompany ", "AK_Proj1", "AK_LastUsedDt", Date
        • ElseIf CDate(LastUsedDate) Then
          • If (Date - CDate(LastUsedDate)) < 0 Then
            • Me. lblMsg.Visible = True
            • Me. lblMsg.Caption = "EVALUATION EXPIRED...., contact ArunKakkarCompany "
            • Me.Frame1.Visible = True
            • Me.lblUseEavl.Enabled = False
            • Timer1.Enabled = False
            • SaveSetting " ArunKakkarCompany ", "AK_Proj1", "AK_Expired", "1"
            • Me.lblUseEavl.Enabled = False
            • Exit Sub
          • End If
          • SaveSetting " ArunKakkarCompany ", "AK_Proj1", "AK_LastUsedDt", Date
        • Else     //If LastUsedDate = "" Then
          • Me. lblMsg.Visible = True
          • Me. lblMsg.Caption = "Evaluation Expired...., contact ArunKakkarCompany "
          • Me.Frame1.Visible = True
          • Me.lblUseEavl.Enabled = False
          • Timer1.Enabled = False
          • SaveSetting " ArunKakkarCompany ", "AK_Proj1", "AK_Expired", "1"
          • Me.lblUseEavl.Enabled = False
        • End If      //If LastUsedDate = "" Then
        • If DateDiff("d", Date, S1) > 0 Or DateDiff("d", Date, S2) < 0 Then
          • Me. lblMsg.Visible = True
          • Me. lblMsg.Caption = "Evaluation Expired...., contact ArunKakkarCompany "
          • Me.Frame1.Visible = True
          • Me.lblUseEavl.Enabled = False
          • Timer1.Enabled = False
          • SaveSetting " ArunKakkarCompany ", "AK_Proj1", "AK_Expired", "1"
          • Me.lblUseEavl.Enabled = False
        • Else
          • Me. lblMsg.Visible = True    'Change
          • Me. lblMsg.Caption = "Only " & (31 - Val(DateDiff("D", CDate(S1), Date))) & " Days are Remaining"
          • 'Me. lblMsg.Caption = "Only " & 31 & " Days are Remaining"
          • 'Me.lblUseEavl.Enabled = True
        • End If
      • Else  //If FS.FileExists(strTemp & "\ AK_StartDt.akk ") Then
        • Fl = FreeFile
        • Open strTemp & "\AK_StartDt.akk" For Output As #Fl
          • Print #Fl, Format(Day(Date), "0#")
          • Print #Fl, Format(Month(Date), "#")
          • Print #Fl, Year(Date)
        • Close #Fl
        • EndDt = CDate(DateAdd("D", 31, Date))
        • Fl = FreeFile
        • Open strTemp & "\AK_EndDt.akk" For Output As #Fl
          • Print #Fl, Format(Day(EndDt), "0#")
          • Print #Fl, Format(Month(EndDt), "#")
          • Print #Fl, Year(EndDt)
        • Close #Fl
        • Me. lblMsg.Visible = True
        • SaveSetting "ArunKakkarCompany ", "AK_Proj1", "AK_LastUsedDt", Date
        • Me. lblMsg.Caption = "Demo Version........ Just for 31 Days."
        • Me.lblUseEavl.Enabled = True
      • End If   //If FS.FileExists(strTemp & "\ AK_StartDt.akk ") Then
    • Else     //If GetSetting("ArunKakkarCompany ", " AK_Proj1", " AK_Expired ") <> "1" Then
      • Me. lblMsg.Visible = True
      • Me. lblMsg.Caption = "Evaluation Expired...., Contact ArunKakkarCompany "
      • Me.Frame1.Visible = True
      • Me.lblUseEavl.Enabled = False
      • Timer1.Enabled = False
    • End If     //If GetSetting("ArunKakkarCompany ", " AK_Proj1", " AK_Expired ") <> "1" Then
  • End If         //If mactno = GValidNo Then

  
Below is the VB.NET Code
  • Here along with date/time based trial version procedure, I also put a small/low quality startup sequence of starting any application software.
  • of course, there are lot of great ways to make software startup/security much more powerful & secure.
  • Below code is the small portion of my small project "Cure"

========================================================
  • Private Sub frmCure_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    • lblContactUs.Text = GDvlprCompanyName & vbNewLine & GDvlprCompanyAddress & vbNewLine & GDvlprCompanyPhoneNo & vbNewLine & GDvlprCompanyEmailId & vbNewLine & GDvlprCompanyWebsite
    • lblActivate.Visible = False
    • txtActivate.Visible = False
    • btnActivate.Visible = False
    • Main(Me)
    • CheckEvaluationPeriod(Me)
  • End Sub
  • ----------------
  • 'Begin---Start point of Cure Project------------------------
  • Public Sub Main(ByVal frm As Form)
    • 'Planning+++++++++++++++++++++++++++++++++++++++++++++
      • '1 Change computer/system date format to dd/mm/yyyy
      • '2 return registration key (rk) from registry
      • '3 if rk =” “or rk not found/exists
        • ' Show “Start up” form
      • ' Else
        • ' Return activation key (ak) by calling appropriate function(say createAK) using os drive serial no 
        • ' If ak != rk
          • ' Show “Start Up” form
        • ' Else    //if ak=rk
          • ' Call function to start s/w (say StartSoftware) 
        • ' End If
      • ' End If
    • '+++++++++++++++++++++++++++++++++++++++++++++++++ 
    • 'ChangeDateFormat()
    • Try
      • CureSecurity(enCureSecurity.ChangeDateFormat)
      • Dim rk As String
      • rk = My.Computer.Registry.GetValue(GKeyPath, GRegistrationKey, "")
      • If rk = "" Then
        • frm.Show()
      • Else
        • Dim ak As String
        • 'ak = retUsrNo(OS_Drive_SNo)
        • ak = CureSecurity(enCureSecurity.SoftwareActivationKey) 
        • If ak = rk Then
          • 'frm.Close()
          • OpenRegisteredCure(frm)
        • Else
          • frm.Show()
        • End If
      • End If
    • Catch ex As Exception
      • CureErrorMsg(ex, "frmModuleFunction-Main")
    • End Try
  • End Sub
  • ---------------
  • Public Function CureSecurity(ByVal Work As enCureSecurity, Optional ByVal UserMachineCode As String = "A") As String
    • Dim s As String = ""
    • Try
      • Dim temp As String = ""
      • Dim ak As New ArunKakkarSoft.ArunKakkarSWReg
      • temp = My.Computer.FileSystem.SpecialDirectories.Desktop
      • 'retrieve the os drive name & then os drive Windows directory path
      • temp = temp.Substring(0, 1) 
      • Select Case Work
        • Case enCureSecurity.ChangeDateFormat
          • ak.ChangeDateFormat()
          • s = ""
        • Case enCureSecurity.SoftwareActivationKey
          • s = ak.GetActivateCodeForSoftware(ak.GetDriveSerialNo(temp))
        • Case enCureSecurity.UserActivationKey
          • s = ak.GetActivateCodeForUser(UserMachineCode)
        • Case enCureSecurity.UserMachineCode
          • s = ak.GetUserMachineCode(ak.GetDriveSerialNo(temp))
      • End Select
      • ak = Nothing 
    • Catch ex As Exception
      • CureErrorMsg(ex, "frmModuleFunction-CureSecurity")
    • End Try
    • Return s
  • End Function
  • --------------
  • Public Sub CheckEvaluationPeriod(ByVal frm As frmCureEvaluation)
    • 'Return “AK_Expired” key from registry
    • 'If AK_Expired = False Or 1 Then
      • 'Disable evaluation button
      • 'Show message “Evatuation period expired etc”
    • 'Else //if AK_Expired=true or 0
      • 'Search AK_StartDt.akk or another name (like AK_StartDt.akk) present in computer “Windows” Directory()
      • 'If AK_StartDt.akk file not present in computer “Windows” directory
        • '1Create new file AK_StartDt.akk in computer “Windows” Directory & write current date in this file
        • '2 Create another file AK_EndDt.akk in computer “Window” directory & write new date which is equal to (current date + 31 days) 
        • '3 enter current date in “AK_LastUsedDt” key in registry
        • '4  display label Demo Version........ Just for 31 Days.
        • '5  enable evaluation button 
      • 'Else if AK_StartDt.akk file present in computer “Windows” Directory
        • 'Return FirstDate from AK_StartDt.akk file
        • 'Return LastDate from AK_EndDt.akk file
        • 'Return LastUseDate from “AK_LastUsedDt” key in registry 

        • //first level of security for evaluation
        • 'If LastUseDate = " " Then
          • 'enter current date in “AK_LastUsedDt” key in registry
        • 'Else if LastUseDate is a date
          • 'if LastUseDate>current date
            • 'display message “Evaluation Expired …. Contact ABC”
            • 'disable “Evaluation” button
            • 'enter False or 1 in “AK_Expired” key in registry
          • 'else  //if LastUseDate<=current date
            • 'enter current date in “AK_LastUsedDt” key in registry
          • 'End If
        • 'Else // if LastUseDate is other than date or “ ”
          • 'display message “Evaluation Expired …. Contact ABC”
          • 'disable “Evaluation” button
          • 'enter False or 1 in “AK_Expired” key in registry
        • 'End if  // If LastUseDate=” ”  

        • '//Second Level of security for evaluation
        • 'If currend date < FirstDate  or current date >LastDate
          • 'display message “Evaluation Expired …. Contact ABC”
          • 'disable “Evaluation” button
          • 'enter False or 1 in “AK_Expired” key in registry
        • 'Else
          • 'Show message “only (31-(current date-FirstDate)) days are remaining”
        • 'End if  // If currend date < FirstDate  or current date >LastDate
      • 'End if   // If AK_StartDt.akk file not present in computer “Windows” directory
    • 'End if  // If AK_Expired=false or 1  
    • 'Dim f1 As New frmCureEvaluation 
    • Try
      • Dim ActiveKey As String
      • Dim FirstDate, LastDate, LastUseDate, temp2 As String
      • Dim i As Integer 
      • 'if activekey=1 then evaluation expired
      • ActiveKey = My.Computer.Registry.GetValue(GKeyPath, GIsActive, "0")
      • If ActiveKey = "1" Then
        • ExpireEvaluation(frm, False)
      • Else    'activekey=0   'active key<>1 
        • If Not My.Computer.FileSystem.FileExists(GetCureFilePath(CureFiles.Cure_dll)) Then  'if Cure.dll file not found
          • 'write to Cure.dll
          • WriteToFile(CureFiles.Cure_dll, Format(Now.Day, "0#"), False)
          • WriteToFile(CureFiles.Cure_dll, Format(Now.Month, "#"), True)
          • WriteToFile(CureFiles.Cure_dll, Now.Year, True) 
          • 'write to Cure1.dll 
          • Dim LastDt As Date
          • LastDt = DateAdd(DateInterval.Day, 31, Now.Date)
          • WriteToFile(CureFiles.Cure1_dll, Format(LastDt.Day, "0#"), False)
          • WriteToFile(CureFiles.Cure1_dll, Format(LastDt.Month, "#"), True)
          • WriteToFile(CureFiles.Cure1_dll, LastDt.Year, True) 
          • 'write to registry
          • My.Computer.Registry.SetValue(GKeyPath, GLastUsed, Now.Date.ToShortDateString)
          • frm.lblEvaluationMsg.Text = "Demo Version........ Just for 31 Days."
          • frm.btnEvaluation.Enabled = True
        • Else 'if Cure.dll file found 
          • 'read from Cure.dll
          • FirstDate = ""
          • For i = 1 To 3
            • temp2 = ReadFromFile(CureFiles.Cure_dll, i)
            • If FirstDate = "" Then
              • FirstDate = temp2
            • Else
              • FirstDate = FirstDate & "/" & temp2
            • End If
          • Next
          • If IsDate(FirstDate) Then
            • FirstDate = Format(CDate(FirstDate), "d/M/yyyy")
          • Else 'if someone make changes in file data
            • ExpireEvaluation(frm, True)
            • Exit Sub
          • End If 
          • 'read from Cure1.dll
          • LastDate = ""
          • If My.Computer.FileSystem.FileExists(GetCureFilePath(CureFiles.Cure1_dll)) Then
            • For i = 1 To 3
              • temp2 = ReadFromFile(CureFiles.Cure1_dll, i)
              • If LastDate = "" Then
                • LastDate = temp2
              • Else
                • LastDate = LastDate & "/" & temp2
              • End If
            • Next
            • If IsDate(LastDate) Then
              • LastDate = Format(CDate(LastDate), "d/M/yyyy")
            • Else 'if someone make changes in file data
              • ExpireEvaluation(frm, True)
              • Exit Sub
            • End If 
          • Else  'if Cure1.dll file not found
            • ExpireEvaluation(frm, True)
            • Exit Sub
          • End If 
          • 'verify again that FirstDate & LastDate are valid date else evaluation expire
          • If Not (IsDate(FirstDate) And IsDate(LastDate)) Then
            • ExpireEvaluation(frm, True)
            • Exit Sub
          • End If 
          • 'get LastUseDate from registry
          • LastUseDate = My.Computer.Registry.GetValue(GKeyPath, GLastUsed, "") 
          • 'first level of security for evaluation
          • If LastUseDate = "" Then
            • My.Computer.Registry.SetValue(GKeyPath, GLastUsed, Now.Date.ToShortDateString)
          • ElseIf IsDate(LastUseDate) Then
            • If (CDate(LastUseDate) > Now.Date) Then
              • ExpireEvaluation(frm, True)
            • Else  'if LastUseDate<=CurrentDate
              • My.Computer.Registry.SetValue(GKeyPath, GLastUsed, Now.Date.ToShortDateString)
            • End If
          • Else 'if LastUseDate is not a date & not empty
            • ExpireEvaluation(frm, True)
          • End If 
          • 'Second Level of Security for evaluation
          • If (Now.Date < CDate(FirstDate)) Or (Now.Date > CDate(LastDate)) Then
            • ExpireEvaluation(frm, True)
          • Else
            • frm.lblEvaluationMsg.Text = "EVALUATION VERSION------->>>Only " & (31 - (Now.Date - CDate(FirstDate)).Days) & " days are remaining!!!!!"
          • End If
        • End If  'If Not My.Computer.FileSystem.FileExists(filePath) Then  'if Cure.dll file not found
      • End If 'If ActiveKey <> "0" Then
    • Catch ex As Exception
      • CureErrorMsg(ex, "frmModuleFunction-CheckEvaluationPeriod")
    • End Try
  • End Sub
  • --------------
  • Public Sub ExpireEvaluation(ByVal frm As frmCureEvaluation, Optional ByVal ModifyActiveKey As Boolean = True)
    • Try
      • Dim ExpireMsg As String
      • ExpireMsg = "EVALUATION EXPIRED...., contact ARUNKAKKARCOMPANY "
      • If ModifyActiveKey Then
        • My.Computer.Registry.SetValue(GKeyPath, GIsActive, "1")
      • End If
      • frm.lblEvaluationMsg.Text = ExpireMsg
      • frm.btnEvaluation.Enabled = False
    • Catch ex As Exception
      • CureErrorMsg(ex, "frmModuleFunction-ExpireEvaluation")
    • End Try
  • End Sub
  • ---------------------
  • 'Begin-----File Handling in VB.NET ---------------------------------------------------------
  • Public Function GetCureFilePath(ByVal file As CureFiles) As String
    • Dim path As String = ""
    • Try
      • Dim temp As String
      • temp = My.Computer.FileSystem.SpecialDirectories.Desktop
      • 'retrieve the os drive name & then os drive Windows directory path
      • temp = temp.Substring(0, 1) & ":\Windows\"  'Cure.dll"
      • path = ""
      • Select Case file
        • Case CureFiles.Cure_dll
          • path = temp & "Cure.dll"
        • Case CureFiles.Cure1_dll
          • path = temp & "Cure1.dll"
        • Case CureFiles.CurePurchaseOrder_txt
          • path = My.Computer.FileSystem.SpecialDirectories.Desktop & "\CurePurchaseOrder.txt"
        • Case CureFiles.CureServer_ini
          • path = My.Application.Info.DirectoryPath & "\CureServer.ini"
        • Case CureFiles.CureDataBaseFile
          • path = My.Application.Info.DirectoryPath & "\CureData\Cure.mdf"
        • Case CureFiles.CureDataBaseLogFile
          • path = My.Application.Info.DirectoryPath & "\CureData\Cure_log.ldf"
      • End Select
    • Catch ex As Exception
      • CureErrorMsg(ex, "frmModuleFunction-GetCureFilePath")
    • End Try
    • Return path
  • End Function
  •  
  • Public Sub WriteToFile(ByVal file As CureFiles, ByVal StringData As String, Optional ByVal AppendMode As Boolean = True)
    • Try
      • Dim path As String
      • path = GetCureFilePath(file)
      • Dim fileWrt As System.IO.StreamWriter
      • fileWrt = My.Computer.FileSystem.OpenTextFileWriter(path, AppendMode)
      • fileWrt.WriteLine(StringData)
      • fileWrt.Close()
    • Catch ex As Exception
      • CureErrorMsg(ex, "frmModuleFunction-WriteToFile")
    • End Try
  • End Sub
  •  
  • Public Function ReadFromFile(ByVal file As CureFiles, ByVal lineno As Integer, Optional ByVal IsFullFile As Boolean = False) As String
    • Dim line As String = ""
    • Try
      • Dim i As Integer
      • Dim path As String
      • path = GetCureFilePath(file)
      • Using sr As StreamReader = New StreamReader(path)
        • 'Read and display the lines from the file until the end of the file is reached.
        • If IsFullFile Then
          • Dim s As String = ""
          • i = 0
          • Do
            • i = i + 1
            • s = sr.ReadLine()
            • If Not (s Is Nothing) Then
              • line = line & vbNewLine & i & " " & s
            • End If
          • Loop Until s Is Nothing
          • line = Trim(line)
        • Else
          • For i = 1 To lineno - 1
            • line = sr.ReadLine()
          • Next
          • line = Trim(sr.ReadLine())
        • End If
        • sr.Close()
      • End Using 
    • Catch ex As Exception
      • CureErrorMsg(ex, "frmModuleFunction-ReadFromFile")
    • End Try
    • Return line  'ReadFromFile = line
  • End Function
  • 'End-----File Handling in VB.NET ---------------------------------------------------------

I hope this would be helpful.
Best of luck for good programming.

2 comments:

  1. Hi Friend..

    I just wanna know where to start with. Whether i have to put forms first or what i have to do. I need clear cut information please.

    ReplyDelete
  2. What if the user sets the same date daily before starting the program ???
    the software will never show the expiry message.

    like if user start the software for the first time on 09 jan 2015 and software have 10 days trial period. that means used can use that software for next 10 days.
    but if the use sets the date to 09 jan 2015 daily before starting the software !!!! it will never expire !!

    ReplyDelete