|
-
Feb 22nd, 2004, 08:28 PM
#1
Thread Starter
PowerPoster
DateTime problem (resolved)
I just can't seem to get my head round this one:
VB Code:
Private Sub btnAlmStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAlmStart.Click
Time1 = Now ' Take initial time value to add HH, MM, SS to
Hours = CInt(cmbHours.Text) ' Assign to global variables values from combo boxes
Minutes = CInt(cmbMins.Text)
Seconds = CInt(cmbSecs.Text)
Dim TS As New TimeSpan(Hours, Minutes, Seconds) ' Create new TimeSpan value and set it
Time1.Add(TS) ' Add it to the initial time to give end time
A couple of lines of debugging coide have shown that Time1 never gets the value of TS added to it. If anyone could point out where I'm going wrong I'd be most grateful.
Last edited by SuperSparks; Feb 23rd, 2004 at 12:08 PM.
Nick.
-
Feb 22nd, 2004, 08:50 PM
#2
Frenzied Member
where are those variables declared? ae they public or friend scope?
-
Feb 22nd, 2004, 09:01 PM
#3
Thread Starter
PowerPoster
They're global variables for the entire project at them moment, though that may change. I put a breakpoint in and checked that everything is being properly assigned. The only thing that doesn't happen is that the TimeSpan value (which is correct) is never added to the DateTime value "Time1".
-
Feb 23rd, 2004, 02:02 AM
#4
Hi.
ADD is a function, not a method, meaning that Add will return the result to another variable so you have to use something like Time1=Time1.Add(TS)
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 23rd, 2004, 11:58 AM
#5
Thread Starter
PowerPoster
That works perfectly, thanks pax
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
|