I need to creater a menu that will offer 4 operations ALL at once by using & vbcrlf [code]heres what i was able to do but it shows all the 4 operation in my msgbox..
How to determine when floating point limitations will cause errors in your calculations. For example the following code. CalculateTotalTax = function (TaxRate, TaxFreePrice) { return ((parseFloat(TaxFreePrice) / 100) * parseFloat(TaxRate)).toFixed(4); };
I have been unable to input any two values that have caused for me an incorrect result for this method. If I remove the toFixed(4) I can infact see where the calculations start to lose accuracy (somewhere around the 6th decimal place). Having said that though, my understanding of floats is that even small numbers can sometimes fail to be represented or have I misunderstood and can 4 decimal places (for example) always be represented accurately.
MSDN explains floats as such... This means they cannot hold an exact representation of any quantity that is not a binary fraction (of the form k / (2 ^ n) where k and n are integers). Now I assume this applies to all floats (inlcuding those used in javascript). How can one determine if any specific method will be vulnerable to errors in floating point operations, at what precision will those errors materialize and what inputs will be required to produce those errors?
I am writing a custom totaling method for a grid view. I am totaling fairly large numbers so I'd like to use a decimal to get the total. The problem is I need to control the maximum length of the total number. To solve this problem I started using float but it doesn't seem to support large enough numbers, I get this in the totals column(1.551538E+07). So is there some formating string I can use in .ToString() to guarentee that I never get more then X characters in the total field? Keep in mind I'm totaling integers and decimals.
Dim L16, L23, L45, t As Double Dim LBase, LAdjacent, LOpposite As Double L16 = 20
[Code].....
Both equations should be equivalent: I've simply replaced L16 with LBase, L23 with LAdjacent and L45 with LOpposite. Yet the first equation outputs 3586 while the second outputs 3587.
I'm using Visual Basic 2010 Express to edit an XML file. I want to replace items that have (typically) non-zero floating point numbers with a single zero.
I will get an error message. I tried something like
Code: Public ObjectPoint As PointF Dim cpoint As New PointF() cpoint.ObjectPoint = New PointF(startX, startY) e.Graphics.DrawEllipse(Pens.Blue, cpoint.ObjectPoint, 0.4, 0.4)
but it didn't work for the location and the circle size. How to draw a circle(and rectangle) by using floating point numbers?
Just when I was thinking that I had Linq To Xml sussed I'm faced with yet another error! I think if I was to understand the linq search process in general better I might have more success, so any good links regarding that are also welcome. To my problem however; using the code below:
I am writing an app in VB2005 that makes a call to my cars ECU. It sends ok but during the DataReceived event I am getting an unusual result.I am trying to find out how many bytes are in the buffer so I can set up an array to write the data to so I have used the following.
Consider the following snippet: Dim Arext() = {"*.ttf","*.ttc"} For Each foundFile In FileSystem.GetFiles(srcdir, SearchOption.SearchTopLevelOnly, arExt)
[code]....
The unexpected result is that not all the files specified in arext() are returned by this code. Running the same code twice on the same subset of files does NOT produce consistent results.I'm seeing, probably, 90% of the files with the other 10% not being included?
I've got the bulk of a calculator up and working, however it doesn't like multiple operations. For example 3x5+2= brings up 10 (i.e. 3+5+2) and even doing it in two parts doesn't help, if I enter 3x5= I get 15 then +2= gives me 32 (i.e. 3x5=15 15x2=30 30+2=32). Also I am getting trialing zeros in my command line I can't debug.Note that lblcommandline displays the whole function and lbldisplay just displays the current imputted number.
Public Class frmSimpleCalc 'This code is run when the program starts. Here we 'declare' or basically, define which variables we want, what they are and such. 'So, for this example, we need two variables. The number we are CALCULATING and the one which we will CALCULATE FROM. Dim lCalcNumberMaster As Long 'The master number is the solution, the number stored and displayed when we click equals.
I think this should be a very basic question. Anyways, when trying to run the script:
[Code]...
I get an "invalid floating point operation" error, and the line "c = Log(a+1.0)/(b/2.0)" gets highlighted. Then, without making any changes whatsoever, I run the script again, and it works perfectly, outputting the value 0.2773... How can I fix this, so that it works right the first time?
Recently we have run into an issue with the Math.Round function. We have developed an application in VB.Net 2008. The executable is compiled to use .net framework 2.0. We have deployed the package to our users and at some sites we get a different result in a computation using Math.Round.
For some time I hav been struggeling to find out way my functions dosent calculate the correct values. If you take my Struct and paste it in.Add six textboxes with two that you can add decimal numbers to rest is just to show the results And two buttons for calculating..[code]
So i know this is more Math related but it would make life so much easier. What i want to do is enter 2 times into 2 text boxes and then subtract them from eachother to find out the hours inbetween as a decimal.
The file operation calls are returning before they are actually complete, or the disk is being cached somehow. What is happening here is that a zipped file containing a number of files to be updated on the users machine has been unzipped and the filenames are returned in an array called 'newfiles'. Each actual file unzipped is temporarily preceded by a '~' character. We rename each existing file to <filename>.old, then delete all the old files. However, sometimes when the code runs, the old files are not deleted. The only explanation for this I can think of is that the second 'Fileexists' is not seeing the files because the filesystem has not caught up at that point. I've never seen this behaviour documented anywhere, though. It works fine when single-stepped.
For Each fn As String In newfiles If .FileExists(fn) Then 'rename existing file to .old delpath = Path.ChangeExtension(fn, "old") .RenameFile(fn, delpath) End If 'rename the new file to correct name i.e. remove "~" [Code] .....
how to go about populating some text boxes with results from calculations. To be more specific, I'm trying to do some trig to calculate various parts of a ci0rcle and will be populating any two of the text boxes then click on a button to get the missing values. I was thinking along the lines of a loop until all values have been calculated.
Im getting mathematical errors. the part that I'm having problems with is, first, it doesn't add the tax to total the correct way. It adds it correctly if I put a dollar(1.00) but when I type one hundred dollars (100.00) it doesn't add the tax correctly. I am trying to compute and display the tax on the new subtotal. Second, it is not adding the correct change to the label in dollars, quarters, dimes, nickels, and cents. Third my arithmatic is not adding correctly when it has to do with the change due back. . Finally, forth I am also trying to do the following:
* add the total for this item to the order sub total and display the new subtotal.
* I have 2 clear buttons, one clears item, the other clears order the clear order button shoule clear out the change due and bordered label and have the subtotal reset to $0.00. The clear item should just clear out the quantity, unit price, and item total textbox.
* When the user has entered the amount of money tendered by the customer and click calc order button, the program should use the amount tendered and the current order total to compute and display the change due to the customer.
* the change due should be displayed in currency format in the readonly label, and should be displayed in terms of the number of dollars and coins due in the bordered label. [code]
I think for you my problem is very simple..I have done the same program in console mode without problem, now i try into windows form...
I generate by random 2 number A&B I multiply them and I will compare it with the result in my textbox3
if it the same as the computer has calculated il will show you congratulation, however i will say try again
I have a problem to calculate the sum, A&B are well generated but nothing in Calc Result
When Calc was working when I write nothing in the textbox3 and i click on Verify it show the msgbox congratulation.I'm looking just for this step, I've fixed the other issues And another things When It's right I would like to random another number for A&B after closing the msgbox, how can I processd ?
I am trying to develop a simple math calculator that will allow the user to input the right-hand-side (RHS) of an equation into a textbox on the application and have the application evaluate the expression for a given value of x, which is also input into the application by the user via another textbox.For example, if the user wants to evaluate the following expression,
y = 3 + 4*x + 5*x^2
then they would input into the textbox the RHS of the equation
3 + 4*x + 5*x^2
and then enter a value of x into the another textbox and click on the calculate button.I tried this:
Edit: Here is a much more simpler example of this issue (i've deleted my original question):
Dim numbers1 As New List(Of Int32)({1, 2, 3}) Dim numbers2 As New List(Of Int32)({3, 4, 5}) For Each n1 In numbers1 ' no warning ' Dim contains = numbers2.Contains(n1) Next
[Code]...
The local variable number1 is redundant and makes the code less readable as @Meta-Knight already has emphasized. Note: All three ways are safe and give the correct result.
Possible Duplicate:Why is it bad to use a iteration variable in a lambda expression.why do I get: "iteration variable in a lambda expression may have unexpected results"? Suppose I have the following code:
I have a windows service written in .NET 2.0 that will run every 5 minutes and executes bunch oracle SQL/PLSQL scripts based on time/validation, it throws the above said error some times against some SQLs, the same SQLs run fine at later point without any error, I have no idea what is going on with the app. I am not sure if this has any thing to do with oracle connection pool as I am properly closing the connections after every SQL execution.
Exception:
System.Exception: Unexpected return code: 1 at System.Data.OracleClient.DBObjectPool.GetObject(Object owningObject, Boolean& isInTransaction) at System.Data.OracleClient.OracleConnectionPoolManager.GetPooledConnection(String encryptedConnectionString,
I have an application that encrypts data which is written in VB. There is another application that uses the same data. Encryption code is the same but it returns different result in some cases. [Code]
well i am having a couple of issues with this particular homework problem and this is my first programming class so there is probably quite a few mistakes well the homework problem is to take three double values entered by a user and display the largest and smallest using math.max and math.min and display the smallest and largest so i thought i could use a listbox and take the values that went to the listbox and assign variables to each so i can try to use each variable in the math.max and min but im not making it to far and i actually might be way off
I would like to create a vb form with a combo box (with song title), a text box (for song lyrics), and a button (to submit or refresh). It is linked with an access database. The combo box is populated with the songTitle field in the db (this part works fine). The text box is populated with the lyrics that go to that song The first updates fine but I can not figure out how to run a query to pass to the text box's text property. I want the user to be able to select a song from the combo box, click the button, and have the text box populated with the new song's lyrics.
Any suggestions on how to accomplish this, or a good place for a tutorial that explains the necessary elements for having vb query a database and return the results?