Hello,
I wanted to make the application to count how many time sit has been runned..so I could make something like a restriction. You know..like run 10 time and get full version.. anyway..I did not find anything to count the startups..so I tried to make the application to create a folder on startup and save a empty file to it and count how many filed are in that folder and display it in label which will say ' Application started for ' + files in the folder + 'times'. I think I could work but I get stuck when I want to save the empty file..I even made a RichTextBox for savin it but it just don't save even if I put text in the textbox..it just create the folde. I have made other Apps which creates folder on startup and then a timer which will save the file every X mins and it worked I even copied the code from that project but still it isnt working... Ill post my code below please help me.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SAPI
SAPI = CreateObject("sapi.spvoice")
SAPI.Speak("Welcome and Have Fun.")
System.IO.Directory.CreateDirectory("D:\Sys")
Threading.Thread.Sleep(50)
RichTextBox1.SaveFile("D:\Sys\nfo" + TimeOfDay + ".txt")
Dim s As String = "D:\Sys"
Dim d As New System.IO.DirectoryInfo(s)
Dim intFolders, intFiles As Integer
intFiles = d.GetFiles.GetUpperBound(0) + 1
Label6.Text = ("Program Started for " & intFiles.ToString & " time(s).")
End Sub
I wanted to make the application to count how many time sit has been runned..so I could make something like a restriction. You know..like run 10 time and get full version.. anyway..I did not find anything to count the startups..so I tried to make the application to create a folder on startup and save a empty file to it and count how many filed are in that folder and display it in label which will say ' Application started for ' + files in the folder + 'times'. I think I could work but I get stuck when I want to save the empty file..I even made a RichTextBox for savin it but it just don't save even if I put text in the textbox..it just create the folde. I have made other Apps which creates folder on startup and then a timer which will save the file every X mins and it worked I even copied the code from that project but still it isnt working... Ill post my code below please help me.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SAPI
SAPI = CreateObject("sapi.spvoice")
SAPI.Speak("Welcome and Have Fun.")
System.IO.Directory.CreateDirectory("D:\Sys")
Threading.Thread.Sleep(50)
RichTextBox1.SaveFile("D:\Sys\nfo" + TimeOfDay + ".txt")
Dim s As String = "D:\Sys"
Dim d As New System.IO.DirectoryInfo(s)
Dim intFolders, intFiles As Integer
intFiles = d.GetFiles.GetUpperBound(0) + 1
Label6.Text = ("Program Started for " & intFiles.ToString & " time(s).")
End Sub