|
-
Jan 14th, 2012, 03:31 PM
#1
Thread Starter
New Member
On load (startup) default state - how?
Hi
I haven't used VB in decades and I'm restarting with what I thought would be a simple program.
I have two fields on a little form, both of which display a date (dd/mm/yyyy). Field1 is an entry field except on load where is contains a date calculated from field2 (which is 'now' upon application load). Field1 is 'now' + 10 days. This is the default state.
Once loaded (with the data described above), the user can input only in field1. Field2, an inactive field used only for display, is field1 - 10 days. After 15 seconds, fields 1 and 2 revert to their default states as described in the first paragraph.
I'm getting all messed up with the 'on load' state. Can anyone give me a bit of guidance, please? I'll start playing with the timer once I get the initial stuff done.
Thank you for any help.
Cheers,
Notwen
-
Jan 14th, 2012, 03:34 PM
#2
Frenzied Member
Re: On load (startup) default state - how?
is your onload
causing yo to have objects and item not available errors?
-
Jan 14th, 2012, 03:55 PM
#3
Thread Starter
New Member
Re: On load (startup) default state - how?
It's more a case of how to start the app with the two fields properly entered, Field2 with Now and Field1 with Field2+10days, just on startup. Only then allowing a user only to enter Field1 with a date.
I have the form built and that displays properly but I'm really fuzzy on the Private Sub StartupCode() Handles Me.Load part. Because I also use a datetimepicker (dtp) field and use a subroutine which runs when the dtp value changes, it seems to go there and run that code - after the initial startup (I think). So I believe that the default state just gets overwritten.
Am I explaining it properly?
Thanks
-
Jan 14th, 2012, 04:01 PM
#4
Frenzied Member
Re: On load (startup) default state - how?
ok now you are tallking
you are using
onload
textbox=now()
and the textbox_Change event fires briningup the datepicker - yes?
you want to stop the datepicker from being involved at the startup - yes?
is everything else ok so far?
here to talk
-
Jan 14th, 2012, 04:15 PM
#5
Thread Starter
New Member
Re: On load (startup) default state - how?
Yes, that's it.
I assume that simply entering something in the field (even using Me.Load startup handler) will fire the ValueChanged event and cause it to run.
How do I keep that from happening on the load (and subsequent timer event when I change it back to the default settings? Do I put all the code in the ValueChanged event instead?
Thank you
-
Jan 14th, 2012, 05:30 PM
#6
Frenzied Member
Re: On load (startup) default state - how?
simply put a value in a flag come where
a timer could be responsable for changing it
the flag (variable) whatever is to tested when th e textbox change event fires and the event exits when the flag is found
like
sub blah_event
if flag then exitsub
end sub
have you got the idea?
here to talk
-
Jan 15th, 2012, 12:54 PM
#7
Thread Starter
New Member
Re: On load (startup) default state - how?
Now why didn't I think of that? 
Working on it now and it's almost there - including the timer.
Thank you for the helping hand, Incidentals!
Cheers!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|