Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Easy Solution For Adding And Subtracting Time


I have two combo boxes. In each combo box the user can select a time. It basically is for a user to select what time he wants to run a certain train pattern. So lets say in the one combo box, he selects 8:00 and in the next he selects 12:00. What i need to do is find the difference and display how many hours the pattern is run. In this case it is 4 hours if it is 8:00 AM to 12:00PM and 16 hours if it is 8:00 AM to 12:00 AM. You see the mess you can get into. But, does vb have some time format that would make this easy to do, that would automatically do time subtraction and addition. Any suggestions would be greatly appreciated.

Thanks,

Jeff




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Adding/subtracting From A Time Value
Ok, I’m sorry if this question comes across as a little stupid but I am relatively new to VB and am trying to get on top of it.

As part of a school assignment thing, I have created an international clock device. I have pretty much finished it, although I have encountered some trouble in adding/subtracting or otherwise modifying time values. The following is a sample of the code I’m using for the clock:

Code:
lblTIME.Caption = Format(Time$, "h:mm:ss AMPM")
So basically I want to know how to add and subtract values from a time string. From experience with VB, I’d guess this to be a fairly simple process. I'd be very grateful if someone could please help me out on this. Thanks.

Adding Or Subtracting Time
I need to calculate time differences in a database through code. What is the format for subtracting or adding time in VB?

Adding And Subtracting Time
I am currently working on a games competition program, and i need help with the following:

A time is entered of how long it took to complete a level, for example: "11:54" (11 minutes, 54 seconds)

and the amount of time that a certain item is used is also entered

what i need is, for each item used, 25 seconds is added on to the time, do you understand??

how would i go about it??

please help me!



Edited by - vbstudentncn on 3/16/2006 4:02:55 AM

Adding Subtracting Time Values
This has been bugging me and I can't figure it out.

I use DTpicker to allow users to pick start and end times for a work shift (3 shifts a day).

There is also a combobox which allows for the seelction of 0,.25,.5.,.75,1 for lunch deduction

I want to figure the time between the two times selected and display them in a label.

Everything seemed to work fine but on my 3rd shift, I tested 11:30PM as the start and 7:30AM as the end and get something like 16 hours.

How can a write a routine which will figure the correct times regardless whether they span over the midnight mark?

Please help guys, cuz I'm really getting fustrated...

Adding And Subtracting Time From Time..
I find this hard to explain but I will do my best. I have a flexgrid, that is supposed to display times in it. For example Row 1 will have 6:00 Row 2 will have 6:10. I have tried using a for next loop to change the time as it goes down the rows. However, I can't figure out how to add say 10 minutes to 6:00 and display that in the next row. I have the following, incorrect code.


Code:
num1 = 6:00 'syntax error obviously
For i = 0 To 14
gridtimes.TextMatrix(i, 0) = num1
num1 = num1 + 0:10 ' as well syntax here
Next

Subtracting A Time Interval From A Date Time Value (RESOLVED)
I know I am asking something really silly, but I have not got my thinking cap on this issue yet, since there are heavier ones I am preoccupied with, and at these times, the lighter ones slip your mind.

I need to subtract a time interval from a date and get the resultant date time . For Instance, I need a function that would return to me a date time value which is the result of subtracting 20 minutes from the date time value 7th June 2003 4:29 00 PM.

Do I have to write one?

Subtracting And Adding From An End Of A Line
Hi I have visual basic 6 and I was wondering how I would add and subtract charcters from an end of a line. For example if I wanted to subtract 4 characters from the string "This is a test" I would get "This is a "

I would also like to know how to add from the end line. For example I had "aaaaaa" and I wanted to add 4 "a" to the end of that line to get "aaaaaaaaaa"

Thanks for the help in advance.

Adding/Subtracting In Access
Okay, I'm fairly new at VB - actually, at VB and Acccess together.

Anywho, here's my problem/question.

I am writing a checkbook type program and I have one database (in access) and a table. Within the table I have a field called Balance and one called Amount.

Amount is entered in by the user, but Balance is the one I want to be calculated when the user clicks the calculate button.

Is there anyway to go into Access and add or subtract all of the amounts to give me a Total of withdrawals and deposits?

I'm using OptDeposit and OptWithdraw to differentiate whether the Amount entered is to be added or subtracted.

Wow, I really hope this makes sense to someone.

Thanks for your help...

Adding And Subtracting From Textbox
Hello!

I was wondering if it is possible to have a label called label1, and a textbox called text1. I want it where when i hit a botton it can add whats in label1 plus whats in Text1 and give a sum to label2. Is there a way to do it with subtraction to?

Adding To And Subtracting From A Date
Lets say I have a date like: 10/31/2006

I need to both add one year to that date and subtract one year from that date so that I will wind up with three dates:

10/31/2005
10/31/2006
10/31/2007

I tried doing a +12 and a -12 but that didn't work the way I need it to. Is this a datediff thing?

Subtracting And Adding Characters
Hi I have visual basic 6 and I was wondering how I would add and subtract charcters from an end of a line. For example if I wanted to subtract 4 characters from the string "This is a test" I would get "This is a "

I would also like to know how to add from the end line. For example I had "aaaaaa" and I wanted to add 4 "a" to the end of that line to get "aaaaaaaaaa"

Thanks for the help in advance.

Adding/subtracting Variables
hi guys, I'm trying to add/subtract variables in vb6 but for some reason the program truncates the decimal number. for example if i have a number say 8 - 4 then it works correctly however if i have 8 - 4.5 the system truncates the '.5'. Any idea on what i should do so that the sytem will not truncate the '.5'. thanks in advance guys.

Adding And Subtracting Dates
Can anyone help me? I am not understanding how math works when dealing with dates. The code below is not working properly. In my database, I have some dates that have expired, but I am not getting the message box I am expecting.

What exactly is this code saying, in mathematical terms? Code:Dim days As Integer = CInt(expDate.Subtract(DateTime.Today).TotalDays) I think it says (expire date - today = total days). If total days is positive, no expired chemical. If negative, chemical has expired. Seems simple Maybe there is something else I am not seeing here?


Code: Private Sub MetalsLab_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'StockSolutionsDataSet.MetalsLab' table. You can move, or remove it, as needed.
        Me.MetalsLabTableAdapter.Fill(Me.StockSolutionsDataSet.MetalsLab)

        Form1.Hide()
        '-------------------------------------------------------------------
        Dim counter As Integer
        Dim Nbr As Integer = StockSolutionsDataSet.MetalsLab.Rows.Count

        For counter = 0 To (Nbr - 1)

            'Check to see if there is a disposal date
            If TextBox6.Text <> "" Then
                counter = counter + 1

            Else 'Not disposed of yet--Check for expire

                'Expiration Date
                Dim expDate As DateTime
                Dim myString As String = DateTimePicker1.Text
                expDate = CDate(myString)


                Dim days As Integer = CInt(expDate.Subtract(DateTime.Today).TotalDays)
                Dim wpcc As String = StockSolutionsDataSet.MetalsLab(counter).Metals_Lab_Lot_Number
                Dim chem As String = StockSolutionsDataSet.MetalsLab(counter).Chemical
                Dim expir As Date = StockSolutionsDataSet.MetalsLab(counter).Expiration_Date

                Select Case days

                    Case days < 0
                        MessageBox.Show(wpcc + " has expired.")

                    Case days = 0
                        MessageBox.Show(wpcc + " expires today.")

                    Case days <= 10
                        MessageBox.Show("You may want to order " & chem & vbCrLf & "expires in " & days.ToString & " days")

                    Case Else 'If days > 10 Then
                        'Do Nothing

                End Select

            End If

        Next counter

    End Sub

Adding And Subtracting A Number Caption?
I was just wondering if it is possible to be able to independantly add and subtract from a number value in VB?
So for example
If Label 1 was 0
How could I then Add to this figure?

Private Sub Command1_ Click()
If Label1.Caption = 0 Then "Label1" + 5

as a result of clicking the command button, the user will add 5 to the number, whatever it is as Label 1. So if the label was 5 it would go to 10, 20 to 25 etc...

I'm sure the code ive given to try and explain my example doesn't work, but does anyone know of any simple code that does?

Two Command Boxes Adding &amp; Subtracting
I have two different command buttons that take a number and either subtracts or adds them depending on what button is pushed. The one for the subtraction works fine but the one for addition doesnt add them but rather concatenates them.

An example would be like this 100 -25 = 75 for the minus function but the addition one shows 100 + 25 = 10025

The code for the text box is here
Text6.Text = Text1.Text + Text5.Text
pretty simple but I dont know what is going on is there some special thing I have to do to make addition work

Adding And Subtracting 60 Digit Integers
Hi I have very little programming knowledge and i need to make a calculator that can add and subtract 60 digit integers ASAP.
I can't explain the situation but i drastically need help with this.
Thank you in advance

Subtracting And Adding Items In Table
how to subtract items from datafieldname in table1 in sql then add it on other table?

Adding And Subtracting The Results Of Textboxes
Hello,

I have three textboxes in my code which will contain numbers (money amounts):

Textbox 1 will contain a price
Textbox 2 will contain a deposit amount or 0.00 if none
Textbox 3 will contain a warranty amount or 0.00 if none

I want to take the price and subtract the deposit then add the warranty.

How can I do this?

Thanks

Pendle

Darkening Effect By Adding/subtracting BackColor
Hello,
I'm working on making a darkening effect on Mdi child forms while options form is modal to Mdi form. I have tried adding to the command button BackColor property but it doesn't work. I want to be able to do the below.


Code:
Private Sub mnuOptions_Click()
cmdButton.BackColor = cmdButton.BackColor + 20
frmOptions.Show 1, Me
cmdButton.BackColor = cmdButton.BackColor - 20
End Sub

But that didn't work because the color is in hex so i tried this.


Code:
Private Sub mnuOptions_Click()
cmdButton.BackColor = cmdButton.BackColor + &H200000F
frmOptions.Show 1, Me
cmdButton.BackColor = cmdButton.BackColor - &H200000F
End Sub

And it still doesn't work. Is there a way to do this?

By the way the default hex color of the button is &H8000000F& .

Little Help Taking Data, Adding Or Subtracting And Moving.
Hi there all, I have another project I am working on and I have a bit of a problem. I have a worksheet with a bunch of numbers 1000-9000 going down the column a from cell a4. going across a3 are months,march05 , april 05 to march 06. I have corresponding worksheet for each month except march which was done before and entered manually and columns for a5 down are some of the same numbers but not all and sometimes more than once. Say for example I have the number 1111 in april and i have values in the f column which should then be subtracted from any other value in the f column with the number 1111 or if the number is in the g cell it should be added. Then whatever the total of that month, negative or positive should be taken to the origianl sheet with all the numbers and added or subtracted from the previous months value. My question is , how would I begin to do this. I am able to carry the data but only from worksheet to worksheet not cell specific. Thanks all.

Evaluating The Date And Adding One Year And Subtracting One Day
I did a search and couldn't come up with an exact answer...

I put together a string:

Dim evalDate, evalYear, midYear
evalYear = InStrRev("" & Date & "", "/")
midYear = Mid$("" & Date & "", evalYear + 1)

evalDate = "" & cmbDay & "/" & cmbMonth & "/" & midYear & ""
(evalDate should now have the form 1/14/2003, depending upon what the comboboxes hold for a value).

What I'm trying to do is take evalDate and add 1 year and minus 1 day. Now, I know there has to be an easier way instead of writing 100 if statements to subtract the day, and if it is 1, subtract one from the month also. All help is greatly appreciated!


Thanks.

KenVB

Easy Solution
Hi,

I haven't been here in some time, and I haven't been keeping up on my VB. But I'm back!

I have a little question that I think there is a really simple solution for, I just can't remember what it is. I need to get the text I have in a txtBox and convert it to an Double

Basically, I need to take this...


Code:
Dim startVal As String
Dim stopVal As String

startVal = Text1.Text
stopVal = Text2.Text

and then make new variables called startNumVal and stopNumVal and get the strings from startVal and stopVal (which will be a number) and convert them to a Double so I can use these variables in a for loop...

Thanks!

Subtracting Time
Attached is a program that subtracts one time from another. Does anyone know an easier way to do it without the Dim Temp1 as date?

Subtracting Time
how do you subtract time from yesterday to today?

example is 10:13 pm of january 1 and 01:12 am of january 2

Subtracting Time
Hello,

I am writing a time clock to record employee hours. I need to be able to subract the time clocked in from the time clocked out.

Thanks

Subtracting Time
In my program, you punch in...and it records the time...then you punch out and it records that time....but how can i make it find the time elapsed?

Easy Saving - Solution
Make a new project with a non visable form and a dialog box. Put this code in there.


Public ProjPath As String
Public ProjName As String
Public FromProj As New Collection
Public WithDots As New Collection
Public FullName As New Collection



Public Sub Form_Load()

ZipLocation = Command
If Dir(ZipLocation) = "" Then
MsgBox "Winzip not found in command line - " & Command
Unload Me
Exit Sub
End If
With cd 'Get .VBP
On Error GoTo quitit:
.Filter = "*.vbp"
.FileName = "*.vbp"
.CancelError = True
.ShowOpen
On Error GoTo 0
fn = .FileName
End With
If fn = "" Then Unload Me

'remove retained
Open "c:dummy.txt" For Output As 1
Open fn For Input As 2
Do Until EOF(2)
Line Input #2, inline
If Left(inline, 8) <> "Retained" Then Print #1, inline
Loop
Close (1)
Close (2)
Kill fn
Name "c:dummy.txt" As fn

FromProj.Add fn 'Add Project name to collection


Dim wanted(2) 'Types of file to package
wanted(1) = "Form"
wanted(2) = "Module"

Open fn For Input As 1 'Run through project and check if wanted
Do Until EOF(1)
Line Input #1, inline
For il = 1 To UBound(wanted)
If Left(inline, Len(wanted(il))) = wanted(il) Then
pe = InStr(inline, "=")
inline = Mid(inline, pe + 1, 999)
ps = InStr(inline, ";")
inline = Mid(inline, ps + 1, 999)
FromProj.Add inline
End If
Next
Loop
Close (1)

ProjPath = PathName(FromProj.Item(1))
ProjName = FileName(FromProj.Item(1))
zipname = ProjPath + ProjName + ".zip"
WithDots.Add FromProj.Item(1)
For l = 2 To FromProj.Count
fp = FullPath(FromProj.Item(l))
If fp <> "" Then WithDots.Add fp
Next

For l = 1 To WithDots.Count
wfn = WithDots.Item(l)
If InStr(wfn, "..") = 0 Then
FullName.Add wfn
Else
Do Until InStr(wfn, "..") = 0
wfn = StripDots(wfn)
Loop
FullName.Add wfn
End If
Next

For l = 1 To FullName.Count
CheckFile = Dir(FullName.Item(l))
If CheckFile = "" Then
MsgBox "Problem with " & FullName.Item(l)
End If
shellstr = ZipLocation & " -a -p -ex """ & zipname & """ """
shellstr = shellstr & FullName.Item(l) & """"
Shell shellstr
For Delay = 1 To 10000
DoEvents
Next
Next

MsgBox "All zipped up"
Unload Me

Exit Sub
quitit:
Unload Me
End Sub




Public Function FullPath(FileName)
If Trim(FileName) = "" Then
FullPath = ""
Exit Function
End If
If InStr(FileName, ":") <> 0 Then
fn = FileName
Else
fn = ProjPath + FileName
End If
FullPath = fn
End Function

Public Function PathName(FileName)
ps = 1
Do Until ps = 0
lps = ps
ps = InStr(ps + 1, FileName, "")
Loop
PathName = Left(FileName, lps)
End Function
Public Function FileName(fn)
ps = 1
Do Until ps = 0
ps = InStr(fn, "")
If ps <> 0 Then fn = Mid(fn, ps + 1, 999)
Loop
ps = InStr(fn, ".")
fn = Left(fn, ps - 1)
FileName = fn
End Function

Public Function BackSlash(fn, sp)
For il = sp To 1 Step -1
ch = Mid(fn, il, 1)
If ch = "" Then
BackSlash = il
il = 1
End If
Next

End Function


Public Function StripDots(wfn)

pd = InStr(wfn, "..")
ps = BackSlash(wfn, pd)
ps = BackSlash(wfn, ps - 1)
bs = Mid(wfn, ps, pd - ps + 2)
StripDots = Left(wfn, ps - 1) + Mid(wfn, pd + 2, 999)

End Function




After you have compiled it run the program with the location of WinZip in the command line. The program will pop an open dialog. Point it to a .vbp and it will pack everything up fr you. Preserves the paths and everything. I use VB5 at home and VB6 at work so the program also removes the retained line as that causes me problems.

If anyone want's to mess on with it feel free, though I would like a copy of the mproved code please.

Enjoy

Subtracting Date/Time
I am trying to accomplish the following in excel:

When Excel opens I want one cell to load the current date/time. However I don't this time to be updated after excel is running.

The cells above this one I wish to display 5 min previous intervals of the current date/time.

Ex:


15 minutes Previous: 03/02/2005 12:45
10 minutes Previous: 03/02/2005 12:50
5 Minutes Previous: 03/02/2005 12:55
Current Date Time: 03/02/2005 13:00 <--- Starting Cell

Thanks a Million for Any Help

Problem Subtracting Time
My program needs to extract a date/time (formatted as m/d/yyyy hh:mm:ss) from a text file and subtract it from the current time. I can't figure out a way to do it without getting a type mismatch. Please help.

Subtracting Time?!?! Getting The Differance
I'm trying to subtract one time with another but I'm getting stuck.
I want 7:00:00 AM subtract 3:00:00 PM and get the total number of hours which is 8 . I'm having no luck figureing out how to do this any help?

Subtracting Current Time.
hello, how can i get the time in less than 5 mins. (eg. if the current time is 5:00, then it should be 4:55) thank for your help.


Code:
if time >= (less 5 mins) then (commands here)

Subtracting Time Fields
In my Access 2K report, I have 2 time values

Morning out Time
Morning In Time

I have a field where I want to subtract morning in time from the morning out time. This is what I'm using.

=Val([Morning out Time])-Val([Morning In Time])

The values are 12:30 - 8:00

The value I get is 4.00.

How can I fix this?

Thanks

Subtracting 2 Time Values
How can one subtract two times (e.g., one the current time, and one preset time) so as to find the difference between those times in terms of hours/minutes/seconds...

I am new to programming...excuse the idiocy of this question, as I am sure the result is extremely simple.

Thanks!

Tricky Little Problem. I'm Sure The Solution Is Easy Though
On my form there is a listbox full of names. This listbox is setup for OLE drag & drop so the user can drag names from this list.

This morning, I added a feature so that when a persons name is hilighted in the list, the "tooltiptext" pops up with additional information on that person.
The problem is that it doesn't look so good because you need to click a name in the list to make the tooltip show up. Doing so changes the mouseicon to the circle with the bar through it because it thinks your starting OLE drag drop.

I almost need some code that says if the user left-clicks and let's go, display the tool tip text...if they left click and hold, then do OLE drag drop.

I hope that makes sense.

Time Additions And Subtracting Jive
Hi Guys,

I simply need a format on how to compare time1 and time2 to get the Difference,if one is big or small.I now have something that works but only for minutes and secods,WHy ?

Comparing And Subtracting Time In Excel
if i have 2 time columns in excel i.e. im trying to synchronise data by only selecting the times which are the same, how do i go about finding the difference between the times and give the answer in milliseconds as an 'int' and not a 'char' or text.

e.g. if i have

03:48:18.457 and 03:48:18.454

i need to subtract the times and use it in an 'if' statement to say if the difference between the times is less than 3 milliseconds then choose the data which is in this time row.
thanks a bunch

Easy Way To Get Russian/Chinese Characters On Label (the Solution, Not A Question)
I searched the forums, and I couldnt find a way to do it. Now that I did find a way, I thought Id share it. I dont know where else to post it. It's extremely easy. First, open Word, and write down something you want in the language (I take Russian for example). Then use Word to save the file as a .txt, using the right encoding (word will ask for this). For Russian, this is Cyrillic Windows. Then open the .txt file, you'll see some weird characters. Select those characters, and copy them to the clipboard.

Now open your project, and select the label (works for any control). Change the font to a font that supports Cyrillic (good ones are Arial and Times New Roman) and use the listbox in the font selection to change the display to Cyrillic. Now simply paste the text in the caption of the label, and all done, there is now russian text on your label.

I hope this helps some people, ive had nightmares on this one.

A Better Way To Figure Total Time Worked By Subtracting 2 Date Values
Currently, this is what I'm using to figure out time card values.

If Val(dteDate1) < 10 Then
dblTotal = dblTotal + (Val(dteDate1) + (Mid(dteDate1, 3, 2) / 60))
Else
dblTotal = dblTotal + (Val(dteDate1) + (Mid(dteDate1, 4, 2) / 60))
End If

This works fine except for when the differanct between 2 times is very small. Then, I get like a value of 11 for 33 minutes.

Does anyone know a better way to figure total time worked by subtracting 2 date values?

Thanks

Subtracting Time From Time
Hey guys maybee i'm just going crazy lol but has anyone tried this before?

I need to subtract two times to see how many hours:minutes:and seconds are between the two so lets say i have this:


VB Code:
Dim str1, str2, timeLength str1 = "10:25:22 AM"str2 = "9:24:11 AM" timeLength = str1 - str2


Here i need to subtract these two so they would give me back something like this:

1 Hour, 1 Min, 11 Seconds

or something like that i can parse it out later any help would be greatly apreciated..

Thanks...

One Solution Every Time
Hi!

I have created the following vb code

VB Code:
Private Sub Command3_Click() Private Sub Command3_Click()List1.Clearnsol = Val(Text1) qid = -1 ' make it safe to PrologCloseQuery(qid) in Err Q = "schedule(Final)"qid = PrologOpenQuery(Q) For i = 1 To nsol Step 1 Call PrologNextSolution(qid)Call PrologGetString(qid, "Final", schedule)    If PrologGetString(qid, "Final", schedule) = 1 Then       List1.AddItem schedule      End If   Next i If PrologNextSolution(qid) = -1 Then   MsgBox "Error", 48, ""   End If    If nsol = i Then   MsgBox "No more Solutions", 48, ""   End IfEnd Sub


Every time i click the button all the values of the variable 'values' are added in list1.
Is there a way that when i click the button only the first solution appears and then every time i click again the next solution appears?

Thank you!

Solution For Run-time Error '3021':
Im using a few text boxes to view records from a table in my database. I have a button that allows me to run through each record in the table. But when i get to the end of the records. i keep on getting an error saying:

Run-time Error '3021':
No current record

When what i actually want it to do is show a msg saying "No more records".

Heres the code that i've been trying to get to work:

Private Sub cmdNext_Click()
If UpdateUnits.EOF = False Then
            UpdateUnits.MoveNext
            PopulateTextBox ' this is function that populates the textboxes from the db table.
Else
    MsgBox "No more records"
End Sub

Can anyone help me please?

Ketes

Help!! Run Time Error 20534 Solution Needed.
running in vb 4 16 bit and cristal reports 4.5 with an access 2 backend, when printing a report in the exe program on a machine with out vb, access or cristal reports on the following run time error is displayed. error 20534 error detected by database DLL. Help!! What is the possible solution to stop the above run time error? i used the application wizard i think that some dll's may be missing but which one's ?


------------------


[This message has been edited by radstudent2 (edited 11-24-1999).]

Seeking A Solution To Real Time Problem.
Dear all,
I have a vb app widespreed thru out india and running in > 500 pcs and 1000
users.

and when i make any changes to the s/w, i send the upgrade to all the
users thru mails.

most of them replace and work with the latest upgrade with out any problem
.But some users donot upgrade the latest version and delete the
mails,which inhibit them to work after the version expires. They then
realize , and starts pressuring us to send the latest upgrade, we do it,
which involves lot of cost and confusion.

How ever i am planning of a alternate solution.-FTP
my app should provide users to access a public directory in server and
permit the users to download the latest
exe and any other files which are useful to them.

Can any one please send me the code to implement this.

Thanx & Regards
Srinivas Varanasi

The Best OCX Time Calendar To Show Of Planning Of Jobs, Who Knows The Best Solution?
Dears

I've to write app for planning of jobs for different kind of jobs (for ex. nurse, driver etc). In fact it should has dimensions: for 7 days in cols and from 8.00 up to 21.00 of hours in rows. Every piece needs to hold 10 minutes long time. So, I need to have cols: (7 days x 3 piece for every day), and rows (13 x 2)
I've tried to make it as 546 of text fields in frame but redrawing of them takes up to much time. Who knows of grid style like control for using for such problem? It needs to look as follows:
------------------------------------------------------
           / monday / tuesday / wednesday / thursday / friday / saturday / sunday
08:00 08:10 08:20 / .........
08:30 08:40 08:50 / .........

09:00 09:10 09:20 / .........
.
.


Rgds
P

Easy Way To Convert Standard Time To 24 Hr Military Time
I am writing a bit of code and I need an EASY, fast way t convert Normal 12 hr time to 24 Hr time. I have thought abou looking for PM on the end of the TIME Variable and adding 12 t the first 1 or 2 Numbers and Truncing every thing after the 5t letter. But I would still have to manipulate the AM time. I there an Easier way?

Thx
Super Newbie

Easy VB Adding?
Well, when i try to add 5 different numbenrs in the 5 different text boxes, it doesnt *** properly....

'If intTestPercentage + intQuizPercentage + intAssPercentage + intHWPercentage + intExamPercentage > 100 Then
'MsgBox "you have put more then 100%"

'ElseIf intTestPercentage + intQuizPercentage + intAssPercentage + intHWPercentage + intExamPercentage < 100 Then
'MsgBox "you have put less then 100%"

'ElseIf intTestPercentage + intQuizPercentage + intAssPercentage + intHWPercentage + intExamPercentage = 100 Then
'frmMarkScheme.Hide
'frmEditClass1.Show

As you can see, the 5 numbers have to equal 100, but they never do when they do actually add up to 100. It always says "you have put more then 100%" even when its equal to or less then 100. But when 1 textbox has the numbers, it works perfectly, telling me if i put over 100% or less than 100% or it exits successfully...

Im new to VB so show me some love

Easy , Adding Strings..
Hi.. may I know how to add two string in VB..
in C++, I do

Code:

CString str1,str2, str;
str1 = "c:\myfolder" ;
str2 = "pagecount.txt";
str = str1+ "\" + str2;
ofstring file;
file.open(str);



in VB I wrote,

Code:

Dim fileName As String
fileName = frmPrinterProperties.IDpath.Text & "pagecount.txt"
IDprefix.Text = fileName
Open fileName For Output As iFileNum ' opening file.. pagecount.txt

but only "pagecount.txt" shows and I can't open the file.. how to fix that?

thank you

Adding A Counter To An Easy Program
Hello everyone, Diesel here. I have one more question that I hope someone can help. The program that I have created, tells you in a messagebox if the letter r or n is the a word when you type it in an inputbox. But, my problem is that I have to make it count the amount of r's and n's in the word. The program is really easy, but it's a problem I just can't get around.
Here's the code...
Dim word As String, num1 As Integer, num2 As Integer

Private Sub cmdexit_Click()
End
End Sub

Private Sub CmdStart_Click()
num1 = 0
num2 = 0
Call jinput(word, num1, num2)
Call jprocess(word, num1, num2)
Call joutput(word, num1, num2)
End Sub
Private Sub jinput(word As String, num1 As Integer, num2 As Integer)
word = UCase(InputBox("Enter a word"))
End Sub
Private Sub jprocess(word As String, num1 As Integer, num2 As Integer)
num1 = InStr(word, "N")
num2 = InStr(word, "R")
End Sub
Private Sub joutput(word As String, num1 As Integer, num2 As Integer)
If num1 > 0 Then
MsgBox "This word contains the letter N"
Else
MsgBox "Sorry no N, try again"
End If
If num2 > 0 Then
MsgBox "This word contains the letter R"
Else
MsgBox "Sorry no R, try again"
End If
If num1 = 0 Then
num1 = 1000
End If
If num2 = 0 Then
num2 = 1000
End If
If num1 > num2 Then
MsgBox "The letter R comes first"
End If
If num2 > num1 Then
MsgBox "The letter N comes first"
End If
End Sub
Thanx
diesel

Copyright © 2005-08 www.BigResource.com, All rights reserved