Convert A Whole Number Into Decimal?
Jan 14, 2012
How to convert a whole number into decimal..For example 70 to .70 because there are some price in my system that needed to be calculated by grams for example $5 per grams... I am saving the price in my database as an integer..
View 2 Replies
ADVERTISEMENT
Oct 29, 2010
I want to convert numbers from 0 to 15 like that
[Code]...
Problem is that when we convert 2 to binary number it gives only 10 in binary, but i want to convert 2 to 4 bit binary number 0010.
View 1 Replies
May 3, 2011
im having trouble understanding this question for a homework assignment. I need to write the PSEUDOCODE for the following scenario, but i got no idea about how to convert a hexadecimal number to a decimal number..You are required to input a two digit hexadecimal number eg. 3f (digits can be entered separately) and calculate the equivalent decimal number. (note the decimal number will be between 0 and 255) . output the decimal number
View 1 Replies
Feb 3, 2010
I want to know how to convert a percentage rate such as 4.5% into a decimal number in your code editor in V 2008.For example, the user input is 4.5%. Is there any function available to convert is to 0.045?
View 4 Replies
Mar 24, 2010
I want to convert e.g. 21/06/2009 15:30:00 to seconds or a decimal number. Just like PHP, which uses a reference date (01JAN1970)
View 4 Replies
Jan 7, 2011
I'm reading a text file that has a single line with the number 70. I want to convert this to a number (decimal or Integer). The following returns 7 - what am I doing wrong? [code...]
View 6 Replies
Jun 27, 2012
What is the cleanest, most readable way to String.Format a decimal with the following criteria
start with a sign symbol (+ or -)
a fixed number of fraction digits
no decimal separator
right aligned
pre-padded with "0"'s
View 3 Replies
Jul 28, 2010
format number to hower many number on left of decimal and 1 decimal without rounding
View 2 Replies
Jun 7, 2009
I'd like to convert a string which contains a decimal number into string that contains the binary value, the octal and the hexadecimal value of that decimal number.Afterwards I also like to convert a string containing a binary, octal and hexd. number into a decimal string.Basically I'm looking for the functions:
dec2bin
dec2oct
dec2hex
bin2dec
oct2dec
hex2dec
I'd not prefer to rewrite a function, I'm sure the framework must have these functions already.
View 5 Replies
Dec 20, 2010
how do you convert a decimal ( decimal place holder = dot) to a decimal (decimal place holder =comma)?
View 6 Replies
Jun 23, 2009
I am calling the function below from an Excel spreadsheet and the conversion from hex to decimal using the VAL function in the "manufacturer" variable below is coming back with a negative value. The VBA edition is 6.5.
Public Function decMEID(ByVal sKey As String) As String
Dim manufacturer As String
Dim serial As String
[code].....
View 3 Replies
Sep 19, 2009
To allow a textbox to contain "15" or 15.5" as numbers nothing else...I figured that ^\d+$ works for numbers but can't get decimals to work also?
View 1 Replies
Dec 7, 2009
I am trying to convert information stored in a file to a decimal (or ASCII) format, then write the contents of that file to a new file.
What I have is a list of files that are generated from a cash register. The documentation that was provided to me says that this particular file I am trying to work with has a length of 6, a width of 6, and that it's BCD type.
I've done quite a few google searches and can't seem to find a good solution. I know BCD numbers should be stored as 0000 format. But the problem I'm getting is when I read each part of the file (using my sr.read) I'm getting full numbers..and I am expecting the 0000 format. I'll get a 0, 0, 0, and then all of the sudden I"ll get a number that's 65,000..then I'll get a 34...and there doesn't seem to be any
I'm sure I'm doing something incorrect here, my knowledge of reading HEX, BCD, etc. is very minimal. I'm guessing it has to do with using a filestream, so I can use the fs.ReadByte() method..but when I tried that my program was literally chugging along for several minutes with no sign of ending.[code]...
View 11 Replies
Feb 1, 2010
How do you convert a decimal into a percentage in visual basic? I have the code to get the problem but I need to move the decimal over two places.
View 8 Replies
Oct 5, 2011
Let's say I want to convert a Double x to a Decimal y. There's a lot of ways to do that:
1. var y = Convert.ToDecimal(x); // Dim y = Convert.ToDecimal(x)
2. var y = new Decimal(x); // Dim y = new Decimal(x)
3. var y = (decimal)x; // Dim y = CType(x, Decimal)
4. -- no C# equivalent -- // Dim y = CDec(x)
Functionally, all of the above do the same thing (as far as I can tell). Other than personal taste and style, is there a particular reason to choose one option over the other?
EDIT: This is the IL generated by compiling the three C# options in a Release configuration:
1. call valuetype [mscorlib]System.Decimal [mscorlib]System.Convert::ToDecimal(float64)
--> which calls System.Decimal::op_Explicit(float64)
[Code]....
View 3 Replies
Aug 18, 2010
[code]...
Very simple, I click a button and it shows the answer in the label. The answer to this is: 00:02:38 (according to excel)
But I want my Vb.net to change the decimals into the time as excel would do so. The answer vb gives me is: 0.001833786. So how can I change a decimal into a time?
View 5 Replies
Mar 25, 2011
how to convert Decimal To datetime?
View 4 Replies
Jun 8, 2009
I have a decimal value and i want to convert it to datetime.
Example:
Dim Excess As Decimal
Dim FixEncodedHours As Decimal
Dim OvertimeLimit As Decimal = 4D
[code]....
How can i convert the decimal result Hr_Ex to datetime?
View 2 Replies
Mar 13, 2009
I need to convert hex to a decimal in VB.NET. Found several examples in C#, but when I tried to convert to VB.NET I was not successful. An example of a hexadecimal number that I am trying to convert is"A14152464C203230304232323020572F544947455234352E".
View 7 Replies
Oct 7, 2010
How to convert string to decimal ?
input - output
45 - 45.00
45.5 - 45.50
45.51 - 45.51
View 1 Replies
May 11, 2010
The code below works until I try to convert the text box to a decimal. I think it might be because at the time of conversion the text box is empty. If thats the case, where could I do the conversion?[code]...
View 5 Replies
Apr 28, 2007
How can I convert the Tax in the following code which is Double to a two decimal place figure[code]...
View 8 Replies
Feb 18, 2010
How can i convert decimal to string so that in can be transferred to a Label?
View 2 Replies
Jun 18, 2009
I currently doing a project..Using VB2005 To convert hexadecimal to decimal. Something to do with serial port..
View 14 Replies
Mar 28, 2012
I have a textbox aka TXT_Weighting in which I place a value of %.
If I put in a number 0 < number < 100, it works.
However, If I put in 100, I get this error: "error converting Data Type numeric to decimal"
The Database Field has the DataType of decimal(10,2).
I have tried converting it to decimal, string, int, float in the application, but once it saves, gives the same error.
I know it is because of the database field having the type as decimal. But I cant stop the entire application, just so I can change the data type of the field.
How do I save it without getting this error? How do I control it from the application?
[Code]....
View 7 Replies
Sep 2, 2010
How can I only add the decimal part of a number to another one?
example: if a number is A = 10.25
Then X = 30
Y = X + 0.25 (Here it added 0.25 which the decimal only NOT 10.25)
Another example, If X = 16.35, A = 102.001
Y = 16.351
View 6 Replies
Mar 31, 2011
I am attempting to take the decimal places of a given input, round it so there are only two decimal places, then change it to a whole number. So far I have been able to remove the integer part of the number, leaving only the decimal, but the other procedures are eluding me. Here's what I have so far: (VB 2008)
Private Function DecimalNumber(ByVal number As Double) As Double
Dim Input As Double
Dim SubtractNumber As Decimal
[Code]....
That code returns the decimal part of the input just fine, and I thought maybe multiplying it by 10 would work....but obviously you run into problems when there is more than one decimal place.
View 20 Replies
Aug 20, 2010
I have class representing a unit of measure with a Decimal as the numeric. Just to simplify things for this example, let's say I'm representing centimeters. I'd like to implement a ToString() method for this class. The thing is, if the numeric value is a whole number I'd like to just display the decimal as an integer. Otherwise, I'd like to keep it as a decimal. So, for example, 10.5D centimeters would display as "10.5cm", but 7.0D centimeters should display as "7cm". I'd like this to be fast and simple to read. I have a working solution, but it seems like there should be a better way.Here's a contrived example showing my first crack at it:
Public Property Units As String = "cm"
Public Property NumericValue As Decimal = 10.5D
Public Overrides Function ToString()
[code].....
View 3 Replies
May 10, 2011
i am using that code i have one datagridview and datagridview cell 3 value is 7
Dim n As Integer
For a = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(a).Cells(0).Value = True Then
n = DataGridView1.Rows(a).Cells(3).Value
[code]....
the above code answer is 4 but i want the answer like that 3.5
View 3 Replies
Oct 30, 2011
How do I check how many decimal places does a number have in VB.net?
For example: Inside a cicle I have an if statement and on that statement I want to check if a number has 4 decimal places (8.9659)
View 1 Replies