We help IT Professionals succeed at work.
Get Started

Help needed with a tutorial.

Peter Kiers
Peter Kiers asked
on
225 Views
Last Modified: 2012-04-17
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
Project manager
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE