Web Browser time limit question

daveofgv

Well-known member
Joined
Sep 17, 2008
Messages
218
Location
Dallas, TX
Programming Experience
1-3
Hello all,

I am making a tabcontrol web browser. I would like to add some settings to the browser which would allow my daughter to only be on it for a certain time limit. Example:

Have a section where I could select a time limit -
checkbox = 10 mins
checkbox = 30 mins
checkbox = 1 hour
checkbox = unlimited

which ever check box I select would be saved in my.settings so when it opens she could only be on it for a certain time before a message box appears saying "your time limit has expired"

I know how to use my.settings but I am unsure how to do a process like this.

I am sure I would have to use a timer control but don't know how to program it.

Anyone know????
or helpppppp

Thanks in advanced

daveofgv
 
Okay. so i came up with a really bad way of doing this. youre going to need to edit this to youre likings...
if you want to use radio buttons, youre going to need to edit this alot... but a textbox works just as well. just make sure you need a password to get into the "Admin" form.
------------------------------------------------------
Used:
2 textboxes
1 button
2 timers.
1 textbox updates the current time
1 is the text box where you type the time you want her off
press button to set the time limit
--------------------------------------------------------
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tmrCurTime.Start() 'to keep updating the time
End Sub

Private Sub tmrCurTime_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrCurTime.Tick
Dim TheTimeNow As String = Now
Dim SplitTheTime() As String = Split(TheTimeNow, " ") 'get rid of the date
txtCurTime.Text = SplitTheTime(1) 'obviously to show you the time.. this was just for me.. you dont need alot of this code.
End Sub

Private Sub btnSetLimit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSetLimit.Click
tmrLimit.Start() 'Start the timer limit
End Sub

Private Sub tmrLimit_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrLimit.Tick
Dim TheTimeNow As String = Now
Dim SplitTheTime() As String = Split(TheTimeNow, " ")
If txtFinalTime.Text = SplitTheTime(1) Then 'Make sure you type the Time EXACTLY. it matches the time perfectly. so if you need to make sure for example its "0:00:00" in that format. you need a zero even if theres only one number like "6:01:01" youre going to need to make sure if you want her to get off at say 10:30 its "10:30:00". But, its as simple as that. Youre welcome!
MsgBox("Times up!") 'this will popup a few times, i can fix that if you want. or you can do that
Application.Exit() ' ends the program after you press the Ok or exit the msgbox...
End If
End Sub
end class
 
Last edited:
Simple Timer Function

public sub Form Load
Timer1.enables = true
end sub

public sub Timer1
dim intTime as integer
intTime += 1
If intTime = 15000 then
msgbox "You Time Is Up"
end 'Pgrogram Close's
end if
End Sub

This is just a rough guide, also set the timer properties interval to 1000 which = 1 second i think? i aint use it in a while, hope this helps :)
 
yeah, that could work... thats less specific then mine. 1000ms = 1 second. but requires a bit more math i suppose. but you can always re-adjust it. But yeah daveofgv, take youre pick. ill be on the forums for a bit. so if you need anything just let me go. but im going around 10:30 ish.
 
TheDeathly,

Works great, however, is there a way to make it auto 15 mins 30 mins etc... rather than having me put in the time each time she wants to get on the internet.

kinda like a pre-set amount.....

So, if she is upstairs in her room and decides to get online I wouldn't have to put in the time before hand?

Thanks
daveofgv
 
ProtecNickz

I have been trying your way, however, it dosn't seem to work. Atleast not in 2008 pro.....

I enabled the timer and have tried in form_load they way you explained and also timer1.start().......

Both ways still don't bring up the messagebox..... any suggestions?

Thanks in advanced
daveofgv
 
Hi yes i went to bed last night, so here we go, i did a quick run up of it for you, and yes i tried the same and for some reason, i got the same, so i assigned it to a Label1.text instead, Which enables the function to work how we want it, hope this helps :)

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Place this in the form load so the timer will be initialised
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'*IMPORTANT* Set the timers propeties interval to "1000" which equals 1 second,
'also set the Label1.Visable to "Disabled if required" and add the value of 0 to it's text

If Label1.Text = "200" Then 'if Label.text's value = "200" then pass to Else and end program
MsgBox("Your Time Is Up", MsgBoxStyle.OkOnly) 'Gives warning when time is up
End
Else
Me.Text = Label1.Text 'Dsplays time if needed
Label1.Text = Label1.Text + 1 'Add the value with the her of the timer
Timer1.Enabled = False 'Stops timer for use
End If
End Sub
End Class

This is simple as it gets.....
 
Excuss me for my ignorance.


add the value of 0 to it's text?

Are you saying don't have any text in it's text property?

I keep getting an error

"Conversion from string "" to type 'Double' is not valid."

As it points to
VB.NET:
Label1.Text = Label1.Text + 1


Thanks

daveofgv
 
lol, in the label1.text properties ADD a "0" so you dont get the error so its not empty
 
Will do, looking in to it now, ill have somthing for you tmoz the latest :D, cya soon
 
Sheesh, lots of stuff happened while i was at school =o im going to work on this for a bit tonight after i eat and see if i can make it easier to have radio buttons... ill probably have something by tomorrow as well.
 
Also, the reason i really dont like having the program do the math is because now i have to have it so if the time is say 5:50. and you click 30 minutes. it has to add 10 and make it 6:20... thats going to be a bit hard... ill try my best. right now i have the radio buttons working.

edit: i cant figure it out. when i try to check if the minute section is over 60 it just makes so stupid number. i added 50 to 20 and it gives me 5020. im not sure how to get past that. so ill give you what i have... its up to somebody else to add checks... Why exactly do you want to limit youre daughter that much? The only thing i could do for you is make it so you can choose between each hour and each 15 minutes. like a drop down box with
12:00
1:15 PM
1:30 PM
1:45 PM
2:00 PM
2:15 PM
If you want me to do that i can... or you can figure it out from my source. but ill have no problem doing it if you want me to... Good luck to you though. I tried mah best :p Surprised there isnt a firefox addon like this or something xD

-- Hope .rar and .zip are interchangeable. if not, let me know xD I dont know why the site doesnt take .rars :O more used the .zips imo.
 
Last edited by a moderator:
Would it be hard or out of your way to see how the drop box would look?

That would be awsome

My daughter has the attitude that she can do whatever she wants and dosn't care what mom and dad say. She has a computer in her room (she's 7) and we have talked about taking it out, but we just don't want her to lose it. We would rather have her learn computers then not have one. So if decided to see if we can limit her instead. I am going to take off a bunch of stuff and hide IE deep down into folders so she can't find it. Or just take it off.

thanks

daveofgv
 
Back
Top