Calculating Numbers And Hours?

Mar 26, 2009

if i have two variables,

Dim Hours
Dim Minutes

what i want to do is add the minutes to hours, so if Hours =2, and minutes = 120 I want to say hours = hours+2, not so simple as it seems or am i missing something?

Dim hours
Dim mins
IF mins > 60

[code]....

View 2 Replies


ADVERTISEMENT

Calculating The Modal Average Of An Array Of Numbers

Nov 6, 2010

OK, so I've been given an assignment due for Monday, which was to create a console program which allows the user to enter an unknown quantity of numbers, then have the Mean, Median and Mode averages displayed of said group of numbers.

So far I've managed to get the Mean and Median to work, for both odd and even quantities of variables. I am however stuck on getting it to calculate the modal average! I don't really know how to approach this, would a structure with two fields, variable and quantity of variable, work?

Below is the code, I haven't made it display discrete of continuous data yet, I'm leaving that for the end.

Module Module1
Sub Main()
Start:
'Declare Variables

[Code].....

I imagine this is quite elementary for most of you, I unfortunately received no replies what-so-ever to my last thread...

PS: Why isn't there an option for UK in the two letter country codes?

View 5 Replies

Calculating Weighted Probability (Random Numbers)

Feb 4, 2009

I am having a bit of difficulty figuring out a way to calculate the weighted probability (weighted "random" numbers) and apply it directly to the selection of a given line of a text file. In short, I wish to have a text file, where each line has it's own probability of being chosen (obviously not all would be the same). I wish the probability to be dynamic, and based off of thirds. As in, say I have 9 lines in a given text file, and I wish to weight the probability of the first three to be significantly higher than the 2/3 and the 3/3 portion of the text document.

Example:
Line 1 20%
Line 2 20%
Line 3 20%
Line 4 10%
Line 5 10%
Line 6 10%
Line 7 3.3%
Line 8 3.3%
Line 9 3.3%

With the above logic, first 1/3 of the lines = 60% sum total, middle 2/3 = sum total of 30%, and the last 3 are a sum total of 9.9% repeating. How would I go about achieving this dynamic assignment of probability, and choosing them randomly, based off of the given weight?

View 3 Replies

VS 2010 My.Computer.Clock.GmtTime - Double Numbers For Months, Hours, Minutes?

Feb 6, 2011

TextBox1.Text = Environment.UserName + "_" + My.Computer.Clock.GmtTime.Year.ToString + "_" + My.Computer.Clock.GmtTime.Month.ToString + "_" + My.Computer.Clock.GmtTime.Day.ToString + "_" + My.Computer.Clock.GmtTime.Hour.ToString + "_" + My.Computer.Clock.GmtTime.Minute.ToString + "_" + My.Computer.Clock.GmtTime.Second.ToString
This produces, for instance, such text in the TextBox1:
MyUsername_2011_2_6_23_22_6

I would like it to displat double numbers for month, day, minute etc, to get something like that:

MyUsername_2011_02_06_23_22_06

How do I do it?

View 6 Replies

Enter More Then 25 Hours Value?

Jun 16, 2009

I have DGV like parent form and detail form like child. I want to give ability to user enter time in detail form in format like HHH:mm, save that value in database and display it in DGV.How to format timepicker or maybe need to use other control to have ability enter time data in format like HHH:mm?

View 4 Replies

How To Add Hours Or Maybe Even Days To It

Nov 15, 2011

This Code allows you too countdown seconds and minutes but im not sure how to add hours or maybe even days to it,[code...]

View 7 Replies

Add 4 Hours To A Date Time Value

Nov 17, 2009

can anyby help me to add 4 hours to the following date time value [code]

View 4 Replies

Application Crashes After Few Hours?

Mar 27, 2011

I am writing a system that utilizes the Timer to execute a command after an interval of three seconds. The command is to send a trigger to my RFID reader and hence the program will then decode the received data and changed it to information. It runs fine for the first few hours, but it will crash after that and the error given is an "System.NullReferenceExeption - Object reference not set to an instance of an object." error. Initially, i thought that it might be something that relates to my comobobox selected index change event that might be causing the crashes, but yet the application is crashes after i removed the section.

I fail to find the reason of the crash, even after spend fewing days finding the memory leak or some other events that might cause the crash.

I have insert TRY CATCH METHOD, just to catch the exeption error message that might cause by one of the codes, but still it doesnt show me.

View 1 Replies

Application Only Runs For A Few Hours

Mar 17, 2011

I have 2 applications, 1 that goes out and grabs data every minute and inserts or updates that data depending on a time interval into sql tables, the other 1 goes out at the top of every hour and grabs hourly data. Both of these applications run perfectly fine when they are compiled and published to run on my development PC, both do xml validation and check for duplicate data prior to any sql insert so I know it's not getting SQL exceptions.

When I move them to the Production Server the 1 minute application will work for a few hours and then freeze up and stop working.The hourly application half the time won't work at all.

I've made sure to include a local copy of the references when I compile/build and publish the application. I've made sure the Production Server is up to date with the latest .Net framework.

View 1 Replies

Calculate Hours And Minutes?

Aug 11, 2010

I would like to calculate the difference between hours and minutes from one textbox and the hours and minutes from textbox two. What would be the best way to do this? I think DateTime would be the object to use, but wondered if anyone has any examples or better ways?

View 12 Replies

Convert A String To Hours?

May 1, 2009

I have a string that extract it from database table row

Dim Hour As String ="4:15 PM"

How to convert the hour String to a real hour for the date type?

View 4 Replies

Convert Seconds To Hours?

Mar 2, 2010

[code]....

View 2 Replies

From Days En Hours To Minutes?

Dec 28, 2011

In a textbox the text 1 Days, 8 hours, 45 minutesI want the outcome in minutes , how do i do that ?

View 7 Replies

How To Sum Time And Convert Into Hours

Sep 6, 2007

I want to know how to sum time like
Case 1
If I have MaskedTextBox included 11:00 am and I have onther MaskedTextBox included 1:30 pm. How I get result be 2:30 hours ????

Case 2
If I have ListBox Included 5:01 , 4:30 , 6:10 , 3:20
5:01
4:30
6:10
3:20
Sum Result
H 18: M 61
Convert To Hours
H 19 : M 01

How to Do this Operation with Code VBnet 2005?

View 14 Replies

Subtract Two Dates Without Using Hours In VB

Nov 3, 2011

I'm writing a program that checks something once a day. When the property has been checked, I store the "Now" value as LastCheckedDate. Since this is a dateandtime, in includes both the value of the date and the value of the time. The next time the program is run, I want to determine if the current value of Now has a different date than the LastCheckedDate. The problem is that functions like Datedif subtract the two values using the times, so if the first check was at 16:30 on 11/2/2011 and the second check was at 9:05 on 11/3/2011, the result is about 16 hours, which is 0 days.

[Code]....

View 6 Replies

Timespan Hours And Minutes?

May 23, 2009

I need a timespan difference result in - hours:mintues format.

[Code]...

View 3 Replies

Timespan In Hours And Minutes

Dec 12, 2010

i am struggeling with the result of this code. It's present 164,4 hours which is correct, but i like it would says 164 hours 24 minutes.

[Code]...

View 3 Replies

Use Datetime To Calculate Hours

Aug 16, 2010

i have a TimeSpan object which calculates hours and minutes that are passed in.[code]

View 8 Replies

VS 2010 Cannot Be Login After 1 Hours

May 22, 2011

now when the user login.. he/she will have a time duration of 1 hours..now when the user play after one hour he/she automatically logout and turn back again to the login page.now i done that after one hour of playing by the user he/she will log out now my problem is how can i prevent the user for login again and said that he cannot play again because his/her time is finish...?

View 4 Replies

A Timer In Hours, Minutes + Seconds?

May 24, 2012

This is what I have so far.

[code]...

The first part (Label 1 + Timer 1) works fine and it counts seconds but I want it to count minutes and hours too.

View 1 Replies

Asp.net - Retrieve Records For Last Few Hours In SQL Server?

Sep 23, 2011

theyI had a asp.net (vb) web application to store work overtime (OT) records. In SQL server, the OT table likes this, e.g.:

[Code]...

As user will input previous date OT records, so the records in db will not be in sequence. the date of records#14 is before records#13. if user want to know which OT records cover the last 2 hours, the system should retrieve record #15 (90mins) & #13 (30mins) because they covers the final 2 hours. How to write the SQL statement to retrieve the records?

View 3 Replies

Convert A Timespan To Hours And Minutes?

May 14, 2009

I am working on a timekeeping application in VB 2008 and need to show elapsed time in hours and minutes. I have no problem eliminating seconds but if the hours exceed 24 the time is displayed as days.hours:minutes and what I need is to show (for instance) 30 hours and 15 minutes as 30:15 not 1.6:15

Is there a better way then using code like:
strHours = (TimeSpan.Days * 24) + TimeSpan.Hours
strMinutes = TimeSpan.Minutes
strTotalTime = strHours & ":" & strMinutes

View 4 Replies

Forms :: DateTimePicker - Tab Between Hours And Minutes?

Jun 18, 2011

Is there a way to tab between the hours and minutes values when the format is set to time in the DateTime Picker? The default action is move to the next control. I have the ShowUpDown set to true. Do I have to set up separate controls, one for the hours and one for the minutes to get this functionality?

View 1 Replies

Go Back And Collect Missing Hours?

Dec 31, 2010

What I need to do is have my application check to see if the last hour that was inserted into the database table is equal to the current hour minus 1 hour when it runs. If it is not equal to the current hour -1 then it needs to go back and download the missing data automatically.

The hours go from 1 to 24 with midnight being the 24th hour as you'll see in my code. My problem is I don't know how to code what I'm trying to do.

Here is the current code:

Private Sub HourDownload()
DeleteFileHour()
If OneHour("C:abcd.pfx", "******") = True Then

[Code]....

View 11 Replies

Logic To Calculate Business Hours?

Aug 16, 2010

I have tried searching all over the web for this logic. Got many but half of them did not match what i was looking for and half were malfunctioning.I want to calculate business working hours between 2 datetime, where in I should be able to set the working hours as well as weekends and holidays should not be calculated.

View 7 Replies

VS 2005 How To Add Hours And Minutes From Code

Sep 21, 2009

I am adding the timespan and displaying it in a text box...the value can be more than 24 hrs that is the reason i m using the following code..[code]Now i want to add the value of wtothrs0.Text and wtothrs1.Text....but in the form of "hrs:min".

View 7 Replies

VS 2008 Countdown In Hours / Minutes?

Jan 14, 2010

Ok so I want my program to keep sending a messagebox pop up at a speed that the user can pick for as long as they choose such as."How many hours" 5."How many minutes" 10..Then that will countdown every minute.[code]

View 3 Replies

VS 2008 Get Hours And Minutes From Double

Oct 21, 2010

to obtain double quantity between 2 hours I do this:

[Code]...

But how would it be inversely?For example if I have a number (double), how I know at all the hours and minutes are they?

[Code]...

View 1 Replies

VS 2008 Get Time Span Between Two Hours

Aug 28, 2009

I'm currently using this code to get the time span between the two hours.[code]

View 4 Replies

Create Another Six Textboxes / Same Time Allocate These Numbers In Ascending / Descending Numbers.

Jun 21, 2010

I have six textboxes, and upon button press it randomly generates six numbers, one in eact text box e.g. [43] [85] [93] [1] [0] [17]..i create another six textboxes and at the same time allocate these numbers in ascending/descending numbers.I am not looking for any codes whatsoever, as i love the challenge of VB.Net.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved