Help needed with a tutorial.

Peter Kiers
Peter Kiers used Ask the Experts™
on
Hi,

I have received a tutorial "How to add a two week trial to your application".
from my previous question. I think this is the answer I am looking for.

But I think its not that well documented and its in VB and I use C#.
So I use developerfusion.com to convert it. I think I have to asked
a lot of questions on EE to get this done. Because I can not do this alone!

Its about this article:

http://www.dreamincode.net/forums/topic/65721-trial-period/

And I get stuck at the first code-example:

01       Dim intTime As Integer = 1
02	Dim dteLastStart, dteStartDate As Date
03	Dim blnFirstTime, blnEnabled As Boolean
04	Dim lngTimeLeft As Long
05	 
06	blnEnabled = True
07	If dteStartDate = Nothing Then
08	    dteStartDate = Now
09	End If
10	 
11	My.Application.SaveMySettingsOnExit = True

Open in new window


And I have this:

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        RegForm frmRegister = new RegForm();
        int intTime = 1;
        System.DateTime dteStartDate = default(System.DateTime);  
        System.DateTime dteLastStart = default(System.DateTime);
        bool blnFirstTime = false; 
        bool blnEnabled = false;
        long lngTimeLeft = 0;
 

        public Form1()
        {
            InitializeComponent();
        }

        private void registerProductToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frmRegister.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            blnEnabled = true;
            if (dteStartDate == null)
            {
                dteStartDate = DateTime.Now;
            }

            my.Application.SaveMySettingsOnExit = true;

        }
    }
}

Open in new window


My questions:
1. In the tutorial it doesn't say what event to use so I have used the load-event.
    is this correct.
2. I have an error at line: "my.Application.SaveMySettingsOnExit = true;"
    and the error saids: "The name 'my' does not exist in the current context".
3. And what does the line at 2 means. What does it do?

Who is willing to help me?

Peter
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Project manager
Commented:
If you are using c#, it would suggest to take a look at this:
http://www.codeproject.com/Articles/15496/Application-Trial-Maker

complete example with code (and better because of the encryption)
Peter KiersOperator

Author

Commented:
Thanks Dhaest.

Peter

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial