Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Save Help
#1
Hi, BP Forums
Can anyone help me with save the Vb data. I am working a project and the main point of the project is that you can only click one button and it becomes disable. then if the person closes the program and opens it the button is still suppose to be disable until for 7 days or more . Please help me!!!!!!!!
Support me by take tour to BPForums http://bit.ly/YTBCS1

Get More Views on youtubehttp://addm.cc/?WIZ01V
#2
Well, there are several methods to do this. You can either use a Settings method, Registry method, or File method. However, there is an old forum topic which discusses how to create a program trial type thing.

<!-- l --><a class="postlink-local" href="http://bpforums.info/viewtopic.php?f=22&t=315&p=1099&sid=37203ca7b51b3686a328545a2b827a64#p1099">viewtopic.php?f=22&t=315&p=1099&sid=37203ca7b51b3686a328545a2b827a64#p1099</a><!-- l -->

If this doesn't help, be sure to say so!
My Blog | My Setup | My Videos | Have a wonderful day.
#3
Hello, manishshrestha60.

This is really easy to do. Basically what you need to do is mark the date the button is pressed, increment it for seven days and then set button's enabled property to false.

1. Go to your project's settings (Project -> <name> Properties...) and create these settings:
Code:
NAME      TYPE      SCOPE      VALUE
day       String    User       0
month     String    User       00
year      String    User       0000
disabled  Boolean   User       False

2. Declare three string variables which will be used as a current date.
[code2=vbnet]Private day, month, year As String[/code2]

3. Double-click on the form to generate Form.Load event. Rewrite or copy'n'paste this code snippet:
[code2=vbnet]' Sets the date variables to computer's current date.
day = My.Computer.Clock.LocalTime.Day
month = My.Computer.Clock.LocalTime.Month
year = My.Computer.Clock.LocalTime.Year

' Checks whether the button is enabled or disabled.
' If the button is disabled, it makes sure it is disabled
' for seven days.
If My.Settings.disabled = False Then
My.Settings.day = day
My.Settings.month = month
My.Settings.year = year
Button1.Enabled = True
Else
Button1.Enabled = False
If year = My.Settings.year Then
If month = My.Settings.month Then
If day = (My.Settings.day + 7) Or day > (My.Settings.day + 7) Then
My.Settings.disabled = False
Button1.Enabled = True
End If
Else
My.Settings.disabled = False
Button1.Enabled = True
End If
Else
My.Settings.disabled = False
Button1.Enabled = True
End If
End If

My.Settings.Save() ' <-- Don't delete this line. It's important.[/code2]

4. Double-click on the button. Rewrite or copy'n'paste this code snippet:
[code2=vbnet]My.Settings.disabled = True
Button1.Enabled = False[/code2]

I assure you this works because I tested it by changing my computer's date.
If you're stuck at some point in this tutorial, click here to see the full code.

I hope this helped you.

NOTE: I was writing this when there was no replies and when I needed the link to the thread, I noticed that Brandon has already replied. Since I took my time write this, I decided to post it anyway.
Also known as Rocketalypse.
System.out.println("I prefer Java.");


Possibly Related Threads…
Thread Author Replies Views Last Post
  getting a file name form a save dialoge zmanalpha 3 13,250 08-04-2012, 03:15 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)