VB - Code That Adds Penalties At Every Hour?
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
ADVERTISEMENT
Sep 20, 2011
I am using vb.net 2010. I have a datagridview whose data source is a data table. I dynamically add rows to the data table.
[Code]...
After adding the new row, m_table is correct. However, DVGCusClient not only adds this row, but also adds two additional blank rows at the bottom. I have no idea where these two blank rows come from. Why I use above code is as follows: Use a data grid view to display data. When a user clicks a row, another form is opened which allows user to search/input some data.When the user closes the form, all data is saved to a data table and shown on the data grid view.
View 1 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
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
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
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
Mar 14, 2011
I thought i had coded correctly to catch the Daylight savings time change, apperantly not.
Here is the code that I used:
If Today.IsDaylightSavingTime() Then
Day = DateTime.Now.AddHours(-1)
Else
Day = DateTime.Now()
End If
View 11 Replies
Jan 16, 2009
I've written a console utility to set file date/time stamps to a specified date/time:
For Each FoundFile In My.Computer.FileSystem.GetFiles(FileSpecPath, FileIO.SearchOption.SearchTopLevelOnly, WildCards) FileInfo = My.Computer.FileSystem.GetFileInfo(FoundFile) System.IO.File.SetCreationTime(FileInfo.FullName, NewDate) System.IO.File.SetLastWriteTime(FileInfo.FullName, NewDate) System.IO.File.SetLastAccessTime(FileInfo.FullName, NewDate) Console.Write(FileInfo.Name + " " + NewDate)Next
When I go to a command prompt to check the results, the new date is correct, but the hour is off by 1 hour. Same when I check the times in Windows Explorer -- all three times are displayed to the same time, but exactly 1 hour earlier.The system date/time are correct (Vista) and we are not in DST.The files reside on a local drive (not a network share).The computer is not on a domain.
View 4 Replies
Jan 23, 2009
I have a problem with a application, when i start the program the speed is ok.after 1 hour of use the prohram go very slow.
View 7 Replies
Nov 18, 2010
I tried to convert my VB6 code to VB2005 and it seems like some syntax cannot be use. I had tried to make it work but it still failling me.how to create a delay timer which can delay up to 5 hours and this will repeatly in 10 loops.
View 8 Replies
Feb 16, 2010
I have a windows service in VB.NET 2008 and want to fire an event every hour on the hour within the service?
I have this working in an application were i assign the current hour to a variable and check each minute if the variable has changed. Is there a cleaner way of achieving this in a service?
I also want the service to read this in form an XML file i have modified from a service control app can i use app.config for this as i've read your not supposed to write to this file?
View 3 Replies
Jul 27, 2011
I am using a textbox in vb.net but the input should be an hour format for example, "13h30". How can I enfprce this by a user? When he puts the first 2 digits like 13 then automaticly the appl. puts a "h" between?
View 1 Replies
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
Jan 5, 2011
I'm working on a program that records date metadata from files, such as creation time, last modified time, etc. An old version of the program is written in VBA, and does something like this: [Code] Both functions are running on the same machine, checking the same file. I've also tried using the IO.FileInfo class with the same result. I've checked thousands of files and they are all off by one hour. The other date properties for creation time and last modified time are also off by one hour.
I forgot to mention in the original post, The computer's time zone is CST, and daylight savings time is currently not in effect. I've reproduced the problem on Windows 7 64 bit and Windows XP 32 bit.
everyone who suggested trying to calculate the desired date from UTC using the appropriate time zone offsets. At this time I'm deciding its not worth the risk to do so. For this particular business requirement, its much better to say the date value is not what you expected it to be because thats just the way the API works. If I attempt to "fix" this then I own it, and I'd rather not.
Just for kicks I tried using the good old Scripting.FileSystemObject via interop. It gives the expected results that agree with Windows Explorer, with about a 5x performance penalty compared to System.IO. If it turns out I must get dates that match what Windows Explorer has, I will bite the bullet and go this route. [Code]
View 8 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)
View 2 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
Jun 9, 2010
How would I go about creating a Timer that will fire an Event every 24 hours, 2 minutes? I know the Interval in ms is 86,420,000, but of course the Timer Interval will not go that high. Do I have to have a series of Timers to go off every minute until 24 hours is reached???
View 6 Replies
Feb 20, 2009
I'm using Visual Basic 2005 Express Edition and I was just wondering if someone could help me out with a few things? I'm making a Notepad-type program just to clarify things.1. I have a button which adds text to my RichTextBox1 (excuse the name), but when you click it it adds text to the end of the script. I want to make it so the text is added where your "cursor" (the blinking thing which lets you know where you're typing) is, at the current part of RichTextBox1. At the moment I'm using:
RichTextBox1.Text = RichTextBox1.Text + "The text I'm adding" If anyone could tell me the code to make it put "The text I'm adding" at your current cursor that'd be great.
2. I have a Save As button and a Save button. When you click Save As and save the file it works 100%, when you click Save and you haven't saved previously then it works 100%, but after you have saved the file and then click save it doesn't overwrite the file. Here's the code for Save:
[code]...
So if anyone can tell me the code that's needed so it will overwrite the current file 3. I have a FontDialog but I have no idea what the code is supposed to be to make RichTextBox1's font change after you click Okay in the FontDialog.
View 12 Replies
Jun 10, 2011
On compiling a visual basic assembly, int32 variables are cast as int64 for calls to adodb methods that require int32. This results in a method not found exceptions at run time. The unnecessary cast operation can be seen when using reflector to inspect the site of the method call and is not present in the source code.To further muddy the waters when the code is compiled on my 64bit windows 7 machine all is well, but on a 64bit windows 2008 r2 the unnecessary cast is added.
View 1 Replies
Aug 9, 2011
How can I create a separate class that has the function that adds dynamic text box, so that I will just call that function to my main form. I have the code below that does add dynamic text box but it is already inside the button of my main
[Code]...
View 10 Replies
Jan 7, 2012
i'm working on an extended combobox control that adds it's items in sub new.
it works but for some reason the form's designer.vb file has an addrange line for the combobox, that results in the items being added twice.
does anyone know how to fix this?
View 7 Replies
Mar 5, 2010
I have a text box that accepts an 8 digit hex encrypted string and adds it to a listbox1. Then I have a button that when clicked takes the string from listbox1 and
1) reverses the string
2) subtracts 235
3) Converts it back to a 9 digit number
4) Adds it to listbox2 using the code:
Code:
Private Sub decrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles decrypt.Click
[code]...
However something seems to be wrong because it get an arithmetic overflow exception. Does anyone know what happens to be wrong with my code?
View 6 Replies
Jul 11, 2011
To add Row programmatically,
Connected Datagridview with datatable
I like to add Blank Row in the datagridview, So
On the Last Cell, CellLeave Event
Datatable1.Rows.Add()
It is adding a row in the dataTable, but adding two rows in the datagridview, why...?
View 3 Replies
Apr 14, 2009
You can find a feedback report with instructions on how to duplicate the problem I'm having at: [URL]
View 1 Replies
Apr 22, 2011
I have a VB2008 application that uses SQL Server 2005 Exspress Edition. I was modifying my application and then decided to add a table to the mdf (named "Pipe.mdf"), which I have don many times before, but I must have messed something up when I made other changes. After I added the new table I opened the Dada Source Configuration Wizard to add the new table to the dataset and I don't see the new table to select it. However, it added a copy of "Pipe.mdf" and named it "Pipe.mdf1" to the Server Explorer.
If I delete this copy of the mdf, it appears again in the Server Explorer when I open the Data Source Configuratuion Wizard.
If I add a Table to the copy of the mdf ("Pipe.mdf1"), it shows up in Dada Source Configuration Wizard.
what to change so that the new table appears in the Data Source Configuration Wizard for the original mdf (Pipe.mdf) and not add the copy of the mdf?
View 2 Replies
Nov 16, 2011
Check process handle count:In Task manager, View, Select columns, mark Handle Count to the view.(The process when loaded has about 333 handles)
Operation:The new thread is set equal to an existing thread, then the existing thread is started and aborted. How does one restore the old handle count? Why do the handles increase by a random number and do not revert?
How can Idisposable/CloseHandle/or GC.collect, Finalize() work in this situation? I'm trying to return the handles to their original count, 333, when I start a new thread it adds 4,5, or 6 handles per new thread(even if the thread is aborted and set to nothing).
[Code]...
View 6 Replies
Jan 2, 2010
I'm new to VB and trying to convert numbers to a string then add the string together but VB keeps putting a space at the beginning of each number after i convert it to a string.
[Code]....
View 2 Replies
Nov 22, 2011
I have list box with item priced. when a user select item and add to the cart then calculate it should display subtotal. My error is when I do it again my previous subtotal add to the next one.
this is my code
Option Explicit On
Option Strict On
Option Infer Off
[Code]......
View 14 Replies
Aug 17, 2010
Say I convert some seconds into the TimeSpan object like this:
Dim sec = 1254234568 Dim t As TimeSpan = TimeSpan.FromSeconds(sec)
How do I format the TimeSpan object into a format like the following:
>105hr 56mn 47sec Is there a built-in function or do I need to write a custom function?
View 4 Replies