Cannot Get Some Fields To Calculate Correctly?
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
ADVERTISEMENT
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
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
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
Mar 26, 2012
i am created a form with DataGridView Binding with ItemStock Table
Table Name is ItemStock
Table fields Names are
Item_Stock
[code]....
View 5 Replies
Nov 14, 2011
I'm currently refactoring an old Visual Basic DLL (VB.Net), which stores all of its data in one module called Globaldefinitions as public fields. There are about 200 fields, referenced thousands of times all around the code:
Public Module Globaldefinitons
Public a As Short
...
Public zz10 As Double
[Code]...
I need to change the module into a class with non-shared fields. This means, each and every of these thousands of references needs to reference the instance of that class:
globalDefinitionsInstance.a = 5
How do I go about this efficiently?
Regular expressions operating on the source fall flat. Refactoring tools like Re-Sharper or CodeRush don't seem to offer this functionality. Visual Studio 2010 cannot do it automatically either.
View 2 Replies
Jun 19, 2011
Class Foo
ReadOnly name As String
Public Sub New(name As String, dependentUpon As Foo)
Me.name = name
[code]....
The output of New Bar() is:
Dependent created. Dependent upon nothing.
Independent created. Dependent upon nothing.
It seems fields are initialized in the same order as they appear in the source code, which (a) leads to an unexpected result, and (b) seems a little puzzling, given that one is normally not permitted to read from uninitialized variables in .NET, yet that seems to be working fine above.I would've expected VB.NET to be smart enough to initialize referenced fields first, and only then those that reference it; i.e. I'd have liked to see this output instead:
Independent created. Dependent upon nothing.
Dependent created. Dependent upon Independent.
how to get VB.NET to behave like that instead, without simply having to swap the declaration order of dependent and independent inside class Bar?
View 1 Replies
May 27, 2012
I'm trying to create a table in Word using data from a table in Access. There are four fields in the access table that I need. 3 fields are text which I can populate the Word without any issues. However the fourth field is a memo with >255 characters.I'm struggling to come up with the proper code to allow me to populate the Word field with the memo data that has more than 255 characters. The code I have so far is listed below. But when it hits the memo field, it crashes on the line I marked with **. I know it's not text, but I've tried many different field types, but nothing has worked so far.[code]...
View 1 Replies
Jan 14, 2012
My intent is to have the code - on a button.click event - check the Username and Password fields and return an error depending on which is wrong. Or if both are wrong, return a different error message. I've set the username as parts and the password as parts (still learning how to use external authentication). [Code]
View 2 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
Aug 17, 2010
I have several sqldatasources for my gridview. All of the columns are autogenerated. However they all have some consistent fields and I'd like to make those fields template fields so I can modify the edit template for them such as adding a drop down menu. Is this possible?
View 1 Replies
Sep 3, 2009
experience on how to create an engine using C# (VB.NET is okay too) that is generic enough to handle most cases of MS Word text fields I need to fill with data I'm getting from a database? In short, I'm about to embark on this little Office automation excursion and I'm hoping a little bit of feedback here.
View 2 Replies
Apr 8, 2012
I have a table which contains a list of products for a company. They input data about how much stock they have and also the level at which they want to be reminded that they need to order new stock.
[Code]...
I want to list all the true results in a form which the user is then able to navigate through. What would be the best way to go about doing this?
View 2 Replies
Feb 13, 2012
how to execute this SQL Statement
Scenario:
Given Tables T_Data, T_AllDesc, T_System1, T_System2
Given Fields:
T_Data= f_id, f_Desc, f_CreationDate, f_CreationTime, f_System1, f_System2
[Code].....
View 7 Replies
Nov 18, 2011
How should I correctly use CancelEventAgrs/CancelEventHandler?Does checking e.Cancel will return always the "right" result, even if the event eventually could consume some time?
Class Foo
Public Event Deleting As System.ComponentModel.CancelEventHandler
Private myObjectsToDelete As List(Of Object)
[code].....
View 2 Replies
Jan 9, 2011
I don't have access to VB.NET right now so I can't test this value:Dim lst As New List(Of String)(cookieValue.Split("$"c))i got this from another question , but was wondering if A. The list will populate correctly and B. What does the c represent?
View 2 Replies
Apr 28, 2011
Im struggling with gettings the values from the correct strings.txt in my resource files in my in folder when switching languages. I have a [URL] (for English) and a domain.nl (for Dutch). It however doesnt seem to matter which domain I use and how I set the currentUICulture, the language shown to the user is always the same!
[Code]...
View 2 Replies
Jun 1, 2011
I'm trying to read a number from a user imput (string) like:
'where "." is grouping separator and "," is the decimal character
dim strUserInput as string = "172.500,00"
dim ret as double
[code]....
How can I correctly use cultureInfo to return 172,500.00 (or 172500,00 or just 172500) to a double var?
View 2 Replies
Nov 12, 2011
I'm having a problem over here; I'm developing a DirectX 9 application, and for some reason, I can't figure the way to close the application completely. This has never happened to me, to be honest. I am using Application.Exit(), which doesn't seem to do anything - it just closes the form, but the program is still running. I have also tried End, but it throws a run-time error I can't seem to figure out.
[Code]...
View 12 Replies
Dec 13, 2009
I have been making a text based noughts and crosses game and trying to convert an alpha grid reference into a number to run the logic sequence that decides whether the an input is valid. I am using the asc command to convert but it just keeps putting up the error: Conversion from string "a" to type 'Double' is not valid, when it reaches the line If (Asc(Left(choice, 1)) >= 65 And Asc(Left(choice, 1)) <= 67) Or (Asc(Left(choice, 1)) >= 97 And Asc(Left(choice, 1) <= 97))Choice is the input and has already been checked for length, whether it contains an alpha and numeric input (and where they are) and whether the numeric value is valid.
View 1 Replies
Jan 13, 2012
Why does the following code: A = not IsDBNull(CurRow("BuyBook")) AndAlso CType(CurRow("BuyBook"), string) = "Yes" results in the following error:
Conversion from type 'DBNull' to type 'String' is not valid.
View 6 Replies
Oct 3, 2011
This form works in VB .NET
sendMsg = "<CStatus timestamp=""0"" " & _
"type=""login"" " & _
"cid = """ & cID & """ " & _
"key=""" & loginKey & """ />"
But I can't get it work in C#
sendMsg = "<CStatus timestamp="0"
type="login"
cid="" + cID + ""
key="" + loginKey + "" />";
It does not give the same effect. I want this as an output:
<CStatus timestamp="0" type="login" cid="var_cid" key="var_key"/>;
Is there any stringXml command in C# or another way to use double quotes in string?
Solved it with XmlTextWriter
View 10 Replies
Jun 30, 2009
I don't know how many different ways I have tried to do this, it never spaces the strings right.[code]...
View 4 Replies
Apr 14, 2009
I 'm having no trouble coding, I'm back to my initial printing problems. The program printed Avery labels in a variety of sizes. I created the label templates on 8.5 x 11 forms and then printed the forms. This cannot be done in VB 2008 for a variety of reasons:
1) The form size cannot be larger than the screen size I got around this by creating a new form class that matched my dimensions.
2) printform only does screen shots. This was a major barrier. First of all I can't get printform to print my custom form because it's not a member of system.window.forms.form, it's a class in system.window.forms.usercontrol. However, even if it was in the correct class, it wouldn't work correctly because printform in VB.net, does a screen capture of the form and then reduces the image on the printout.
So that is my dilema. I do not know how to use the reporting tool, but I can see that it must be binded to a database. Although my application does use a database, I want to be able to massage the data before printing it. And the application does more than just print labels. There are also custom reports that need to be printed.
View 16 Replies
Jun 5, 2009
I am currently working on a project that will read HTML pages and store some information. I am doing this by loading the HTML page into a webbrowser, then viewing the source of the page by using:
[Code]....
View 7 Replies
Dec 8, 2011
Evey time the "bomb" image pops up, the entire thing seems to break. I have trouble shooted this simple game for most of the day trying to figure out where the break is but Ive had little luck. I'll have to post this in multi post because it will not let me post all in one block.
View 11 Replies
Jul 23, 2009
Ive seen that people use Form.Close() and Application.Close(), but what if I have many forms, and I may have forgot to close one of the forms correctly, is there a way to exit the application that actually checks to make sure that all the processes related to the program are closed first? I read on another forum that Application.Exit() is a bad way to close the program, and I found an example code of how to do it the right way, but Ive never found this anywhere else before.
View 3 Replies
Jun 17, 2009
I have a issue with loading a collection. The issue is that when I load a collection up with multiple objects that the only items that are in the collection is duplicates of the last object that was added in. I was through the process of creating the new object and it is loading correctly but when it adds it to the collection, it changes all the prevoius objects with the current object. Here is the code that I am using. I have been messing around with this code for a day now and can't figure it out.
[Code].....
View 3 Replies
Jan 28, 2011
how do you correctly dispose a shape in vb.net ie when you draw a rectangle using the pen function how do I depose it so that it will disappear from the form, for some reason once its drawn if I draw a new shape it keeps the previous one and just overlays the new one and I use shape.dispose, and pen.dispose?
View 5 Replies
Jun 10, 2012
It seems like I keep having problems with dates. I am using the following code:
Dim LocalDateCultureProvider As New CultureInfo(CultureInfo.CurrentCulture.ToString)
Dim CurrentDate As DateTime = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy"), System.Globalization.CultureInfo.InvariantCulture)
ExpiryDate = DateTime.ParseExact(strDate, "dd/MM/yyyy", LocalDateCultureProvider)
If DateTime.Compare(ExpiryDate, CurrentDate) < 0 Then
MsgBox("This file has expired.")
[Code]...
View 1 Replies