clock?

P

pitt

i have datetimepicker with showup on form and customer must select time for
reservation but
if customer click on up or down button datetimepicker must raise(up)
orlowering(down) minute on my clock.

Only selected value can be something like that:

00:00
00:30
01:00
01:30
......
......



i put this code but doesn't work
Private Sub dtpVrijeme_ValueChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles dtpVrijeme.ValueChanged

Dim mjenjam As boolean
If mjenjam = True Then

Dim datum As Date

datum = dtpVrijeme.Value

mjenjam = False

dtpVrijeme.Value = (datum.AddMinutes(30))

mjenjam = True

End Sub



Can some on help me?
 
G

Guest

Hi,

pitt said:
i put this code but doesn't work
Private Sub dtpVrijeme_ValueChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles dtpVrijeme.ValueChanged

Dim mjenjam As boolean
If mjenjam = True Then

well if you just declare mjenjam then it will have the value "false" by
default so your
code inside the IF-block will never run! I don't know why you put these two
lines
in here! By the way the "end if" is missing so i don't even know where this
block ends. I guess you wanted to make sure that you add 30 mins only one
time right?
Then you should declare the mjenjam-variable as a protected or private
variable
in your form-class and initialize it on true (in the constructor or wherever).
Dim datum As Date

datum = dtpVrijeme.Value

mjenjam = False

dtpVrijeme.Value = (datum.AddMinutes(30))

mjenjam = True

Just look here on the last 3 lines of code - as you can see you can delete the
mjenjam = False - because you cancel this effect with the last line.
So your problem is that you want to be able to add another 30 minutes the next
time the user clicks right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top