Errors When Calculating - Doesn't Calculate Anything Correctly ?
Sep 9, 2009
I am making this program for a school assignment but it has errors when calculating
Private Sub frmReceipt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'When this form is loaded, assign the date to the date label & start the timer
lblDate.Text = Date.Now
[CODE]...
So if counter finishes, execute the following code
If counter > 4 And km >= 1 And kmcashset = 0 Then 'If there is still kms to calculate 'And kmcashset = 0
kmcashholder = kmcash
km = km / 5
[CODE]...
And if I add counter = 0 and km = 0 at the end of that "If counter > 4 And km >= 1 And kmcashset = 0" Then it doesn't calculate anything correctly. I supply it with 9 for Distance and it returns 4 for excessdistance which is correct but returns 7 for excessdistancecharge when it should be 4! When I supply 23 for Distance it returns 18 for excessdistance and 11 for excess distance charge which is correct. (???)
Excessweightcharge calculates correctly.
I think it may be the way I'm implementing it, through the use of AND or maybe it's because it's in timer tick?
-Minimum charge of $5 which covers 10 kgs for the first 5 kms only
-Each kg over 10 kgs incurs a charge of $0.50
-Distances over 5 kms incur an additional charge of $1 per km up to 10 kms
-For deliveries over 10 kms, the extra distance should be rounded up to the nearest 5 kms and charged at $2 for each extra 5 km block.
EXAMPLE 1:
Packet weighing 9kms travelling 9 kms
Standard charge for first 5 kms ($5.00)
Weight less than 10 kgs so no extra weight charge
Extra distance charge 9 - 5 kms = 4kms x $1 = ($4)
Total delivery charge = $5 plus $4 = $9
[But my program returns 7 for excess distance charge]
EXAMPLE 2:
Packet weighing 33kgs travelling 23 kms
Standard charge for the first 5 kms ($5)
Excess weight 33 - 10 kgs = 23kgs x $0.50 ($11.50)
Extra distance (23 - 5kms = 18kms):
18kms ( 5 to 10 kms at $1/km) = ($5)
13kms (18-5)/5 = 3 (rounded up) x $2.00 = ($6)
$5 + $6 = $11
Total delivery charge = $5 plus $11.50 plus $11 = $27.50
[My program calculates everything correctly]
View 2 Replies
ADVERTISEMENT
Mar 29, 2010
For some reason I can not get some fields to calculate correctly. It seems anything I enter over 24 in the Pay Rate field it throws it spits out the exact numbers I am trying to multiply. The FWT (0.2), FICA(0.08),and State fields (0.25) respectively.
[Code]...
View 10 Replies
Apr 15, 2012
I am trying to get the first store to calculate the total 5 payroll inputs but it is only calculating the first entry I am not sure what I am doing wrong. Also if I click on the cancel button in my inputbox it bombs.
Private Sub calcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calcButton.Click
' Dim storeTotal As Integer
' Dim store As Integer
[code]....
View 8 Replies
Jul 5, 2009
When I try to use code to move around in my database, using the code presented in:
[Code]...
View 10 Replies
Feb 11, 2012
I'm trying to get an If statement to check is the date picked from a datetimepicker is at least 3 days prior to the current date, I can get it to calculate the difference however if I chose a date that 4 days prior to the current date (i.e the result being -4), the else statement doesnt fire.is this something to do with the result being a negative value? I did try to assign the DateDiff result to a variable defined as a short and then used this variable in the If statement, but still get the same issue. Option Strict isn't showing any issues.
[Code]...
View 2 Replies
Dec 31, 2011
Consider the following:
class Bind
{
public string x { get; set; }
[code].....
View 4 Replies
Aug 30, 2011
I am trying to use impersonation when running an exe on a server. It appears to log in correctly but windows still doesn't recognize the Username.
View 2 Replies
Feb 2, 2010
I'm trying to create a program which will calculate the Fibonacci Sequence which calculates the numbers correctly however, there are a few problems.
1. When using a Do While...Loop the program becomes non responsive.
2. Kind of dealing with the program becoming non responsive; I am unable to stop the process by forcing the sub to Exit.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Operation.Text = "Calculating...."
EStop = False
[CODE]...
View 3 Replies
Apr 6, 2011
On my software , i have a function for search in the list a member . The function have more fields : Girls , Boy , Old , etc ... but the software doesn't work correctly. I want him to search with several conditions, adding AND. Here is the code :
Vb
For Each MemberALister As MemberInfo In _Listemember
If Me.Girl.Checked Then
If MemberALister.Nom.Contains(Me.Genre.Text) Then
[Code]....
View 21 Replies
Nov 23, 2009
I have a VB 2008 application with multiple DataPicker fields. The data is binded to SQL database. On the form load I set the checkBox for each date to false if there is no date in the field. Noticed that if I make changes to some dates for record 1 in the table, save it and scroll to the next record - I see the date that I just changed for record 1 - also on records 2 and 3. Why is it happening? I don't have that problem if I use text fields to display the dates. I had encountered the same problem with different project and just switched to text boxes. With this new project?
View 15 Replies
Jul 9, 2010
I am building a form that will load individual items(from individual files) or a catalog of items(from a list of items). I then click the item I want to use to select it. Everything works correctly, when I click an item it selects the correct stitch. The only problem is, it doesn't display correctly when I load from a catalog. I can open individual items and it works fine. When I load a catalog it doesn't display the images correctly.
[Code]...
View 1 Replies
Mar 3, 2010
Create a generic label method:
Public Function buildBasicLabel(ByVal labelName As Label, ByVal text As String, ByVal font As Font, ByVal align As Integer)
Dim tmpLabel
[Code]....
For some reason, the label is not lining up with the others once I span it. I'm trying to span it to get all the text to show but once I do, it starts pushing it over. I don't see anywhere where I restrict the size so that shouldn't be the issue.
I tried doing all this in the design and it works just fine. Mimicking the designer code doesn't seem to fix it either unless I'm doing something seriously wrong...
Posting images for clarity. NOTE: The borders are just to show the label alignment and the text should read "Flat-Footed AC"
IMAGE 1: Spanning 1 column (doesn't show all text)
IMAGE 2: Spanning 3 columns (still doesn't show text and you can see it's starting to dis-align)
IMAGE 3: Spanning 6 columns (Still doesn't show text and greatly dis-aligned. It should at least show all the text)
View 1 Replies
Dec 16, 2009
In one of my programs I have a datatable on which i calculate different statistics for different subgroups. In my opinion this is as very timeconsuming proces (at least my solution). I was wondering if there is not a more effecient solution.
CODE:
View 1 Replies
Oct 21, 2009
today I finished my VB project which is a program that generates costs of pizza's by what the customer order. The code is all complete just looking for some idea's on to stop bugs and clean up the code. So below is all my code and picture of the form. Errors occur when someone doesn't pick a value, so what i want is there to be default values as 0.
[Code]...
View 1 Replies
Jun 27, 2009
I'm writing this prgram for class, and everything seemd to be working right except for my calculate button. It doesn't show the Calculation. Here is my code:
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateTotalPay.Click
' declare variables
Dim hours As Double
[CODE]...
View 3 Replies
Jan 6, 2012
End A statement which as far as i know doesn't close you program properly and hides errors. Right now i'm being forced to use end because i don't know how else to close my program properly. I'm not sure where my problem is but some of you should be able to fix it. I'm trying to make a game using directx with a game loop. This code is the skeleton of what i'm making.
Public Class Form1
Private ProgRunning As Boolean = True
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Show() 'Make the form appear
Me.Focus() 'Give the form focus
[CODE]...
This code runs alright because end is being used but if you rem end out the error which it's hiding comes out. The error is "Object reference not set to an instance of an object." I'm not totally sure but i'm guessing that the error is refering to the form.
View 9 Replies
Apr 14, 2010
I am using Synclock to prevent multiple threads from logging text messages to the same file at the same time, but this doesn't seem to work:I get frequent sharing errors on the logfile, within the synclock block.The Synclock is using the variable holding the filename, because it exists all the time and because it is always the same object, whatever class instance or thread I'm in.[code]Despite using Synclock and a Using block around the code, I keep getting this error in the sw.WriteLine(Msg) line:System.IO.IOException: The process cannot access the file '(filename)' because it is being used by another process.Should I use some other type of object than a string to synchronize on?I cannot use a user interface object (button or so) because it is a windows service project.It was written and compiled in Visual Studio 2008, but targeting the 2.0 framework because it has to be able to run on some old Win2000 machines.
View 12 Replies
May 23, 2012
Write a complete Visual Basic program to do the following: Joe's Pizza Palace needs an application to calculate the number of slicesa pizza of any size can be divided into.
The application should do the following:
ï‚· Allow the user to enter the diameter of the pizza, in inches.
ï‚· Calculate the number of slices that can be cut from a pizza that size.
ï‚· Display a message that indicates the number of slices.
To calculate the number of slices that can be cut from the pizza, you must know these facts:
ï‚· Each slice should have an area of 14.125 inches.
ï‚· To calculate the number of slices, divide the area of the pizza by 14.125.
 The area of the pizza is calculated with the formula: Area = π r2
Note: The π is pi which is equal to 3.14159.The r is the radius of the pizza. Divide the diameter
by 2 to get the radius.
Form:
The application should be done form-based. You may design your own form. It must have the following:
ï‚· a label indicating that it is Joe's Pizza Palace
ï‚· a field with label to enter the size (diameter) of the pizza
ï‚· a field with label to display the number of slices
ï‚· buttons to calculate the number of slices and to exit the application
Output:
Use the following test data to determine if the application is calculating properly:
Diameter of Pizza Number of Slices
22 inches 27
15 inches 13
12 inches 8
Requirements:
ï‚· Name the project Pizza.
ï‚· Be sure to include your name included in a comment
ï‚· No credit is given for a program that will not execute.
ï‚· All rules of academic integrity should be applied as stated in the syllabus.
ï‚· Submit the zipped project into Moodle.
I have errors saying "With Held " events
WHAT IS WRONG WITH what I HAVE
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3.Click
' End the application
End
End Sub
[CODE]...
View 3 Replies
Apr 13, 2012
I'm using the following code to read in a highscores file with the score written first and the player's name written to the next line, and then display the top 3 scores or fewer if there aren't 3 scores written to the file. A highscores display should have the scores sorted with the highest first so that's what this program tries to implement.
Array.sort() isn't doing a damn thing. In fact, the program's not even reversing the arrays like it should either. I've tested array.sort() this way with the names and scores arrays given explicitly and it works fine. I thought maybe it was still reading the data as string even though it's declared otherwise but it rounds off decimals when I change the array type to Integer so I'm pretty sure it's not that.
I have no idea why reading the data in from a file changes how it's sorted. My teacher didn't understand what was going on either. Does anyone know what's going on here?
Imports System.IO
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code].....
View 1 Replies
Feb 18, 2011
I am using an update panel and when I click a button it will update all the panels. updapanel1.update() is very simple, but my data is not updating unless I hit the button twice. My gridviews shows data for a selected user, and then all the grids reflect that users data. works fine all the update panels work for the gridviews. Now for somereason when i try to do a row count and update the panel with the summary, it does not work, i get either the previous users summary or if i hit update again for the same user i get the correct data.
[Code]...
View 1 Replies
Jun 12, 2011
The string itself contains things like "random" & random.next(1,3) & "random2" etc. The string registers all of this as a string and doesn't actually calculate random numbers.Is there any way to fix this?
View 8 Replies
Sep 23, 2011
I have a .net application that uses customerrors web.config module to display meaningful messages for errors. It works without any issues for 500 errors/exceptions caused by non-ajax and ajax components (updatepanel). However, in a scenario where updatepanel's asynchronous request times out, there is no error raised at all. I was able to see the timeout in firebug and come up with a solution that would at least display the error message as an alert and then redirect the user to the 500 error page using javascript but it's not quite doing what the rest of the application does in case of an unhandled errors like these. I basically just want everything to go through "LogEvent" mechanism so based on the severity of the error, it does the necessary work.This 500 error page doesn't have anything in the Server.GetLastError() for these timeout scenarios. Is this an expected behaviour? Can it be changed so I do have access to these timeouts in Server.GetLastError() OR maybe just run this error through "LogEvent" mechanism? Is there a better/more graceful way to handle this issue?
Below is my code to give you an idea, not exactly what I have in my application but pretty close.
Web.Config
<customErrors mode="On" defaultRedirect="~/Errors/ErrorUnknown.aspx" redirectMode="ResponseRewrite">
<error statusCode="500" redirect="~/Errors/Error500.aspx" />
</customErrors>
[code]....
View 1 Replies
Mar 30, 2009
I am trying to calculate the number of years for my calculate age event handler, however i am apparently missing a method or whatnot because im trying to calculate the age , can anyone suggest help on this. I need to subtract years to get my age but when i try the birthdate.Subtract (currentDate) method i get an error about not able to convert from LONG?
So below is what I have.
Private Sub btnCalculateAge_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateAge.Click
Dim currentDate As Date
Dim BirthDate As Date
Dim Age As Long
[CODE]
View 7 Replies
Jan 4, 2012
So when i build or click debug on my program. No errors come up and its smooth. So i decide to publish my programme. However. I come up with a bunch of errors during the publishing.
Here they are:Error 1 Cannot publish because a project failed to build. 1 1 Simple CALC
Error 2 Unable to copy file "binReleaseSimple CALC.exe.manifest" to "binReleaseapp.publishApplication FilesSimple CALC_1_0_0_0Simple CALC.exe.manifest". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
View 3 Replies
Jun 12, 2011
I am trying to change the background color of a tooltip
I am using tooltip.backgroundcolor = color.colr
No errors but thecolor doesn't change
View 5 Replies
Oct 13, 2010
I use Visual Studio 2003, VB.net, NetFramework 1.4 and Windows XP I have been using the following Code Snippet for a number of years in both Web Services and Windows Applications. However suddenly around the 29th September 2010 it has stopped sending E-Mails from both Web Services and Windows Applications. The same problem has happened not only to my own Network but on two other Networks, one using XP as its Server and the other using Server 2003. All 3 of these are using different ISPs.
[Code]...
View 1 Replies
Jan 7, 2009
I am trying to figure out how bitmasks are calculated in vb... I have the following constants and their bit values:
[Code]...
View 4 Replies
Apr 1, 2011
I'm really new to VB. This is only the 3 app I've created, and I'm stuck.I need to code an app that displays total commission earned on sales at different levels. The commission percentage goes up as sales go up.
Should I write a If/else/else/else/else/then statement or something else?There are 5 different commission levels in the problem. I have my interface designed, but obviously that's the easy part.
View 1 Replies
Jan 27, 2011
I understand the basics of using VB.NET, what I don't understand is what I need to tell the computer to do. I'm supposed to create a subprogram to calculate the greatest common factor and another subprogram to reduce the fraction from the answers retrieved from the first subprogram. My teacher said something about using Mod to calculate it, and also attempted and failed to explain ByVal and ByRef parameters. I don't even know where to begin other than the parameters I have for each, and even those have a high chance of being completely wrong.[code]
View 1 Replies
Jul 27, 2009
I,ve completed a program for a debt solution agency that calculates the amount a client can afford to repay after all his deductions and general life costs, my proplam however is at the end when i have to display all the creditors on a proposal data grid that shows the amount and total months to repay all creditors and calculates the amounts as one of the creditors debt is paid up and that monthly installment is devided between the remaining creditors.
View 1 Replies