.net - Code Optimization On Minutes Pr Hour Calculation?
May 25, 2010
The following code takes a timeframe in minutes since midnight and creates an array with minutes pr hour. But, it's slow. Any better suggestions out there? (no, changing language is not an option :-) )
Const clDeparture As Long = 123
Const clArrival As Long = 233
Dim lHour As Long
Dim lMinute As Long
Dim alHour(25) As Long
[Code]...
View 3 Replies
ADVERTISEMENT
Oct 8, 2008
How to get the total minutes in an hour?
Example:
1 Hour and 20 Minutes.
I need to get the result at 80 Minutes.
View 11 Replies
Jul 15, 2010
Is it possible to configure the System.Timer to run say 30 minutes after every hour? I have searched google to figure this out but all it shows is how to set it where it goes off once an hour, if I launched the app at 2:45 then it would go off again at 3:45. I can forsee issues down the line with this approach where if it went off at a specified time it would not have that issue.
Normally i would use Scheduled Task for this however it doesn't give you the option for hourly just daily, perhaps i'm wrong about this.
View 3 Replies
May 6, 2009
in one textbox i have 10:00 PM and in another textbox i have 12:00 PM....i want to subtract 10:00 PM from 12:00 PM and get result ie 2 hours...how can i perform that?
DateTime.TryParse(TextBox1.Text, d1)
DateTime.TryParse(TextBox2.Text, d2)
the code is to convert the text into time.
[code].....
View 7 Replies
Aug 1, 2011
I use a masked textbox, and I would control the input, the problem is, I use 1 textbox and the control should on the first 2 digits with a maximum of 24 and the last 2 digits with a maximum of 60. Is there a possibility to program this?
View 1 Replies
Jul 24, 2009
Ok, the error I'm getting is "Load Report Failed" and it happens when I need to load a large number of crystal ReportDocument objects. I've searched on this, and there is a property in the registry that you can change to -1 and it allows to load more, however I'm still getting the error, just after I get about twice as many documents loaded.
The report is basically a one page document (for each client in the database with an interest charge). It displays the amount of interest charged, and other information pertaining to the charge. These documents are basically printed out and mailed to the client.
I created a "Print Preview" screen which has a CrystalReportViewer object, and an ArrayList property. The ArrayList property has an array of all reports, and there are next and back buttons to browse through each report. Once they are satisfied, they will print them all out, and I can dispose of the objects.
The solution for this, from everywhere I've seen, is to "Dispose the object after you are done with it". My problem is that I can't dispose it until they are finished with the print preview screen.
Is there a better way to go about this that won't require too much time to code (we are already over the deadline on this project) or a simple solution to get past the ReportDocument limit? Right now it is erroring on report 150., There are 180 records (as of today) that need to be loaded.
View 1 Replies
Jan 20, 2011
How can I Optimize my own code written by VB.net? Is there any tools for it? Does Visual Studio have any one? What's your suggestion? I use VS2008 as my editor.
View 1 Replies
Jan 14, 2010
I came across the following code recently and would like to optimize it:Public Shared Function ComputeLabel(ByVal Action As Integer, ByVal Flag1 As Boolean, ByVal Flag2 As Boolean) As String
Dim Prefix As String = ""
If Flag2 Then
Prefix = "Conditional "
[code].....
View 6 Replies
Jan 20, 2011
I'm wondering if you know if there is a better way to write this code in order to speed it up. It has several blocks of if statements filling arrays, like this:
row0: If x < b(1, 1) Then a1(i, j + 1) = 0
If x > b(1, 1) And x < b(1, 2) Then a1(i, j + 1) = 30
If x > b(1, 2) And x < b(1, 3) Then a1(i, j + 1) = 60
[code].....
View 5 Replies
May 6, 2009
I wrote a VB.NET Windows Service, which works fine. I have only one issue with it. I want the service to execute on the half hour and top of the hour marks (e.g. 9:00, 9:30, 10:00, 10:30, 11:00, etc etc etc). I am using the following code:
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
[CODE]...
This code works, however, if the service starts at, say, 10:15, then it executes at 10:15, 10:45, 11:15, 11:45. How do I make it so it always executes on the 30 minute and top of the hour marks?
View 4 Replies
Sep 19, 2010
I have a situation where I want to add penalty charges after every hour. For example if a target is not met it will start to incur penalties. So after every hour an 80 pound charge is given until it reaches the 5th hour where the penalties incur a 90 pound charge. Is there a way of doing this?
View 2 Replies
Jun 12, 2012
So let's say I have 1400, I want to convert it into 2:00PM I tried the following:Dim convertedTime As String = DateTime.ParseExact(theTime,"HHmm", Nothing)
And it would give me this: 6/12/2012 02:00:00 PM
I do not want the date part, neither do I need the seconds. All I need is 2:00PM
View 3 Replies
Dec 1, 2010
I need to to make a timer that will execute my code every 30 minutes
View 8 Replies
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
May 28, 2009
allow the user to enter a stock transaction and determine the stockbroker's commission. Each transaction includes the following data: the stock name, price per share, number of shares involved, and the stock broker's name. Assume price per share = P. The stockbroker's commission is computed in the following manner: If the P (price per share) is less than or equal to $50, the commission rate is $0.19 per share, if P is greater than $50, thecommission rate is $0.26 per share. If the number of shares sold is less than 150, the commission is 1.5 times the rate per share. Display the results in a message box, including the total commission earned.
View 2 Replies
Jan 7, 2009
i need mathematical calculation model code.
View 2 Replies
Nov 24, 2011
For some reason my code is a little buggy, and i really would like a speed calculator with my program.
'Download progress bar kode
Private Sub WC_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles WC.DownloadProgressChanged
[CODE]...
View 14 Replies
Sep 10, 2009
Im havin a code todo some attendance calculation for abt all the employees in my office.its an automatic pgm which will run at 7 am everyday and email the attendance list before 8am . if theres any error for one particular employee, pgm execution stops and cant continue.since its an automatic pgm i want pgm to run with next employee if the current employee calculation got some pblm. if i use on error resumenext statment if error occur at 11 thline of calculation, pgm still cont to 12th line and executing normal.i dun want it to be lik that.if the error is in 11th line then i want to stop execution of that particular employee and goto next employee....how to do this?
View 2 Replies
Jul 21, 2009
I am looking for formula that is accurate in converting Minutes to Decimal Minutes i.e 30 minutes is 50 Minutes in Decimals so 1.3 hours is 1.50 and not 1.5 i have used Minutes/60 but it is not accurate as some times i have to Multiply the result by 100 and some time 1000 to get correct results based on single digit Try 1/60, 10/60 99/60 or 100/60.What would be the most efficient and correct way to Convert the time into Minutes ?
View 10 Replies
Dec 19, 2009
I need to store a calculation to use later and obtain a new calculation
[Code]...
View 4 Replies
Jul 9, 2010
Here's what I've got thus far:
Dim xpDoc As New XPathDocument(strXmlUrl & strXmlInfo(0) & "?xml=1")
Dim xpNav As XPathNavigator = xpDoc.CreateNavigator()
Dim xpExpression(9) As XPathExpression
[code]....
View 4 Replies
Feb 3, 2011
I have an small physics toy application I am developing. It works fine except the particles will not push each other away, only pull towards, I debugged that sub going through it command by command and realised the value 'H' would not change, what ever it was set to during the first pass through the sub is what it kept, the only way to change this value is to manually set it i.e 'h = 1'. Once the calculation is redone on the 'H' value it resets to what it was previously, even though the x1,y1,x2,y2 are all different, thus meaning H should be different.
I think it is me that has made a mathematical mistake somewhere, but I cannot see where it is. I need a fresh pair of eyes to look over my work. Please let me know if you find anything.
[Code]...
View 1 Replies
Oct 30, 2009
I have been developing an antivirus using vb.net. The virus scanner works fine but I was thinking of ways to optimize the scanning speed (because large files take forever)
View 3 Replies
Jul 16, 2009
In a project of mine I'm currently doing this:
[code]...
all classes inherit docMain and addTemplateToList( X ) adds x to a List(Of docMain). Now my question is: Is there a better way to do what's done in the code sample? I thought of something like:
[code]...
Is this somehow possible in VB.net (Reflection?)?
View 3 Replies
Jan 26, 2009
I have a DataGridView where I bind a datasource (sql query) to it. The row count is high with many columns. Trying to scroll through this DGV is painfully slow.
Does anyone know of any kinds of optimization I can do so that I can scroll faster? Like what is the DataGrid doing when you scroll? Does it repaint every screenful? Does it validate every row? It seems like it is doing something unneeded when a user scrolls.
View 4 Replies
Mar 17, 2012
I have written a code which does the thing as the title says. The problem is, the whole process took 10 minutes just for 1000 records. Here is the code:(Written in vb.net 3.5 and sql server ce)
MyConnection.Open()
Dim count As UInt32
cmnd = New SqlCeCommand(sqlstring, MyConnection)
[Code].....
View 1 Replies
Mar 7, 2011
i am trying to add a text file in Debug folder. But when i go to project tab to add a new item, there is no option to add a new item? What part of the setting needs to be changed? Using Visual basicExpress 2010.
View 1 Replies
Apr 14, 2011
I have an application that provides a countdown for 60 minutes and I'm currently using the win form timer and it updates some labels and a progressbar. Now I have to change this to be a countdown for 360 minutes. Will the win form timer be sufficient or should I implement a Timers.Timer instead?
View 6 Replies
Oct 11, 2008
I am stumpted when it comes to getting the current system hour.
View 3 Replies
Dec 2, 2011
ghtSavingTime to the hour
View 3 Replies