getting a formula round off to the next highest .25.example:
2.35->2.50
2.26->2.50
2.24->2.25
2.51->2.75
I can't use the Round function because if I have 2.26 then it will round off to 2.25 which is unacceptable.I have been using the Ceiling function but it rounds it off to the nearest highest integer. Which can add an almost extra kg,lb to my formulas.
Is there any prebuilt items to roundup a number to set fraction size or do I need to build a routine to do this? If I have to build this any thoughts on the way to go about it? I was thinking I need to strip the decimal places and then compare them to a dataset of numbers a make a choice?
I'm creating a maths program and when it comes to division it's giving me .34216 as answeres which isn't what I want.I was thinking declaring the textbox the answer appears in as a single.It's not working out though and it's still using decimal points.I was told by my teacher to declare it as an integer so I tried that too, it's not working out also. I figured based on the code, I would be declaring array3() as the single or integer since that's the textbox the answer will be output into. [code]
I have tried following coding to get highest value.EX: If I type 4.341111111111, It should get the value 4.35. If I type 9.132222, It should be 9.14 not 9.13.[code]
I'm trying to find a way to force my calculations to round up currency values to the nearest whole pence/cent.By default, rounding will round to the nearest pence/cent, whether this is up or down.I need it to always round up regardless.[code]My client's back office system rounds in this manner which is rather peculiar to say the least, however the prices on his website need to match and to to this they need to be rounded up.The built in ASP.NET Math.Round function only offers the regular rounding(and banker's rounding) and not an option to force rounding up or down.
I am working in excel trying to setup a function involving multiplying a cell by a set number and then having the result round to the nearest 10. Here's the beginning of my function statement fx=e3*1.026. say the result is 8654, I need it to round to 8650. Also if it comes back 8655, I need it to round to 8660. I have about 2,000 records I need to do this to so I was hoping that one formula or statement could be used for all my data.
I was using this old method of creating a bunch of rectangles when I need to get the location of a certain point within a grid so I could draw images on the grid. The thing is, I don't want to use rectangles, I want to be able to just round the location as if I were using rectangles. I need it to be able to round the point (66,70) to (50,50) so if you can imagine a grid and the mouse position being within that square in the grid, I need to get the location of the upper left corner of that square.
With the following problem which I want to round up the "TotalVolume" and "AvgHL" with 2 decimal places. However, my ListView2 is still showing as the following example.
Example: ID --------- Average H/L ----------- Average Volume 12 --------- 1.230000 ----------- 4251.230000 17 --------- 0.560000 --------- 12345.560000 23 --------- 0.320000 --------- 2345.010000 54 --------- 1.230000 --------- 122.550000
Dim conn As SqlConnection conn = New SqlConnection(Source)
I have written a program to return the colour of a pixel from an image. The problem I have is I need to return the colour name. Of course not all colours returned will be one of the pre-defined colours (knowncolours), so my question is, is there a way to find the nearest knowncolour which matches the colour of the pixel?
I have looked at GetNearestColour but am confused by its function. It just seems to return the same colour as the parameter passed into it.
For example, how would I get the # "220" from the number "229". Or the number "300" from "309"? The only way I've found to do this is using string stuff, but I'm afraid of the overhead for strings?
I use Mschart to produce charts. What I am trying to get is the nearest data point by where I click on the chart. The problem is that I can't find any connection between the HitTest values and the data point x/y values.Say, I clicked on the following point:
Dim result As HitTestResult = Chart.HitTest(e.X, e.Y)I have now values of X and Y where I clicked. How to associate it with the data point values?
What I want to achieve is to double-click on the chart which would find the nearest data point (x,y as integer) and knowing these values I would be able to recalculate other values based upon where the user needs it and double-clicks.
i got a function that search for database data, is it possible that i make it search the nearest words or keywords? which mean if d name is TEST, n i key in TE then it will show those name wit TEST TESS TSST? [Code]
[code]How can I validate that if 387 mod 2 <> 0 then it should display the nearest double. In this example, it should display 386 which is nearest to 387 and can be fully divide by 2.
i'm building an image library and one of the things i want to do is compare the most common color in a given image to a set of established colors in rgb format the way i'll probably do this is create 3 arrays for the average r,g and b of each given image, and then compare them to my established values for r,g and b that i want to match to so if my first image has the average values of 255, 125 and 5 for r,g and b..what would be the best way to do a nearest match against my pre-established colors? (about 32 in total)
I'm trying to round a double to the nearest 5th or 10th number. So far my code looks like this basically:
'Mathamatical equation For Cost to Mow dbCost = (txtArea.Text / dubMetres) + intExclusions * 3 + (intIrregular / 2) Dim dbRounded As Double 'Trying to round to nearest 5 or 10
I have read about Round() and MidpointRounding.ToEven but I still could not figure how to use it to achieve what I want. I have numbers (usually from 5 digit decimal) such 125.36 , 125.10, 125.99. I want to make the 2 decimal point rounded to the nearest 20. Means, the 2 decimal point should be either .00 or .20 or 0.40 or .60 or 0.80 only. 125.36 should be 125.40 : 125.10 should be 125.00, 125.99 should be 126.00 125.54 should be 125.60 and so on Is there math function to make or I should parse the number as text and test the last 2 digit?
I'm doing an assignment for class which is basically a simple program that takes 12 monthly temperatures and averages them. But I also need to round the average to the nearest tenth. I am not particularly good at programming or math and don't know how I would fit this into my code. I am Including My program thus far. I put in bold and italic where the calculation takes place.
Private Sub btnEmterTemperature_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmterTemperature.Click 'FOR BUTTON CLICK EVENT "ENTER TEMPERATURE"
The window is 600x600, because the game uses a 'grid' of thirty. Each food block is 30x30, and so is each block that makes up the snake. Here is my food making sub:
I have a program that will round any numbers I give it regardless of the data type I set (I've tried double and decimal) before it saves into the DB. I'm using MS access for the DB and I've set the data types in access to Numeric Double, Numeric Decimal, and Currency and all with decimal places set to 4 -- all to no avail.
What I do know: 1) The textboxes on the form accept the number value as I enter it and after I hit save the value displayed is the same as the number that I entered. However, once I query the database again for that entry the value has been rounded up/down to the nearest integer (whole number). For example: I enter 1000.50 and hit save. I search for that same entry and the value is saved as 1000. If I enter 1000.51 and hit save then search for the entry it shows the value saved as 1001.
2) I can store the desired value directly into the DB by manually entering it. When I search for that entry from within the program it displays the correct amount. HOWEVER, if I try to change the amount and then hit save I get a concurrency violation.
I think that it may be a setting somewhere in the program that doesn't allow for decimal places but I've search everywhere and I cant find anything.
I'm currently working on a project in which at one point, the user may right click a button which brings up a contextMenuStrip. I am already able to find the owner accurately from that strip, and manipulate the button clicked as follows:
Dim myItem As ToolStripMenuItem = CType(sender, ToolStripMenuItem) Dim cms As ContextMenuStrip = CType(myItem.Owner, ContextMenuStrip) Dim buttonPressed As DataButton = DirectCast(cms.SourceControl, DataButton)
But now for the tricky part. Within this contextmenuStrip, I have a DropDown menu with multiple items in there. I would assume you would be able to work your way up the ladder doing casts like above in the manner of
Unfortunately, when I try to get the sourcecontrol from this menuStrip, it return Nothing. Any ideas on how I can get the button that was pressed from this toolStripMenuItem? My current code is as follows (in which the sourceControl is Nothing)
Dim myItem As ToolStripDropDownItem = CType(sender, ToolStripDropDownItem) Dim dropDown As ToolStripDropDownMenu = CType(myItem.Owner, ToolStripDropDownMenu) Dim menuItem As ToolStripMenuItem = CType(dropDown.OwnerItem, ToolStripMenuItem) Dim cms As ContextMenuStrip = CType(menuItem.Owner, ContextMenuStrip) Dim buttonPressed As DataButton = DirectCast(cms.SourceControl, DataButton)
how to go about doing what I did in that first method, but just working my way up from further down the ladder?
I'm having a problem with my Access database.I have to select the highest ActieAantal before the last action ( )because the last action is always the sum (Totaal).this is a part from my table
The next person also has some acties with corresponding Actieid and a Total when I use this query I alway get the 999 values
SELECT Register.Persoonid, Max(Register.ActieAantal) AS MaxVanActieAantal FROM Register GROUP BY Register.Persoonid ORDER BY Register.Persoonid, Max(Register.ActieAantal);
but when I try to exclude the 999 value I get nothing
SELECT Register.Persoonid, Max(Register.ActieAantal) AS MaxVanActieAantal FROM Register GROUP BY Register.Persoonid HAVING (((Max(Register.ActieAantal))<>999)) ORDER BY Register.Persoonid, Max(Register.ActieAantal);
find the highest 'ActieAantal' after excluding the 999 values?
I want to get the n highest values from an integer array that has n or more elements. This can obviously done by sorting an slicing the array, but I'm wondering if there is a more efficient way to do this, since sorting a whole array would be quite ridiculous when for example only the top 2 elements of an array with length 4200 are asked for.