Rounding off from 2.90 to 3.00 is very unusual. 2.90 is rounded to 3, for that you can use asl ss125 says Math.Round. You cannot use Math.Round(2.90, 2) to return 3.00, it will return 2.90!

Fine. I dont know whether VB.NET has any options to do with it.. But If you need a custom round function,I will tell you the logic to create your own round function.

Here it is

1) Get the input in ther string format.
2) Using substring(),find the location of the [.] in the value.
3) now remove all the other number after the first digit of the decimal point using trim().

eg: 6.758698955 => 6.7

4) Store the value before [.] in a variable.

consider it as variable j

5) then get the value after the decimal point.
6) convert it into integer.
7) now in if condition you have to check two conditions.

7.1) if(i<5)
7.2) if(i>=5 and i!=9)
7.3) if(i=9)
8) Write appropriate code for each statements such as

if(1<5)
do nothing

ie., 6.4 => 6.4

if(i>=5 and i!=9)
do calculations based on what type do you want.if u don't need to do anything, skip this segment.

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
decimal pi = new decimal(3.14159265);
decimal piRoundedUp = Math.Round(pi, 4);
decimal piTruncated = Math.Round(pi, 4, MidpointRounding.AwayFromZero); //3.1416
// MidpointRounding.AwayFromZero is use
// to Round 2.5 to 3 where
// MidpointRounding.ToEven rounds to 2
// See http://msdn.microsoft.com/en-us/library/system.midpointrounding.aspx
Console.WriteLine("{0:0.0000}", pi); //normal round
Console.WriteLine("{0:0.0000}", piTruncated); //as above
// first multiply with 10^(number of decimals)
// and then devide with 10^(number of decimals)
// because Floor gets the integer part of the decimal.
decimal piFloored = Math.Floor(pi * (decimal)Math.Pow(10, 4)) / (decimal)Math.Pow(10, 4);
Console.WriteLine("{0:0.0000}", piFloored); //3.1415
Console.ReadKey();
}
}
}

I'm trying to compare 2 different CSV files, mark those differences respectively, then produce it as an output. However, my code seems to be only reading the last part of ...

I am becoming confused with visual studio v. Vb.net. I am findings hundreds of pieces of code tells me how to connect. Snippets elsewhere that tell me how to access ...