OdbcDataReader In Showing Decimal Fields Decimal Separator Disappear With DB2 Dsn?

Oct 19, 2010

OdbcDataReader in showing decimal fields Decimal separator disappear with DB2 dsn

View 3 Replies


ADVERTISEMENT

.net - String.Format Decimal With Sign Fixed Number Of Decimal Places, No Decimal Separator?

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

Filter Xml Using Xpath And Linq (price With Decimal Separator And Thousands Separator Spanish)?

Jun 7, 2012

I'm trying to filter the results of a xml file. One of the fields I've been requested to filter is the attribute price of each node. The problem is the xml is from a spanish source and the prices are with decimal separator being , instead of . and thousands separator is , instead of .I'm trying to get an xml file filtered where only nodes withprices lower than one supplied appear.

The xml structure is:

<RoomStays>
<RoomStay InfoSource="" Price="201,60" Discount="0" MealPlan="Sólo alojamiento" MealPlanId="1" Provider="Marsol" ProviderId="3" HotelName="HOTEL LA ESTACION" Rating="" Latitud="" Longitud="">

[code]....

I've tried to filter using XPath and Linq2Xml. I've come to the conclussion I have to replace , with . and . with , but I get 0 results.With values below 1000 where there is only , I've got it using:

doc.XPathSelectElements(./RoomStays/RoomStay[translate(@Price,',','.')<=256.78])

But when there are prices above 1000 with thousands separator . it doesn't work, so I tried:

doc.XPathSelectElements(./RoomStays/RoomStay[translate(translate(@Price,'.',''),',','.')<=256.78])

But it returns 0 results (I tried to use replace function instead of translate to remove the . characters but I get an exception).

View 1 Replies

Datatype Mismatch Due To Decimal Separator?

May 14, 2008

I have a app that updates an Access Database via a datagrid view. I'm updating two column of type Single. The code works perfectely when the regional settings are default US-EN.For computers running in germany an update to the backend database throw a datatype mismatch error. I change the decimal separator on the computer with 'German' for region settings from Comma (,) to (.) period and everything works fine.I add thread culture to US-ENG at the startup of the application. Now the error disappears but then 2.5 is now stored as 25 in the access database.

I add these lines at the beginning of the application soon after the designer code

System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US") System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("en-US")

This is a MDI app and this code is in the container window...

View 12 Replies

Format Decimal Number (Comma As Fraction Separator With Two Digits)

May 22, 2012

Is there a format string to format a decimal to 000000000,00. So first 9 digits, right padded with zeros if needed; a comma as fraction separator and two fraction digits.
0 => 00000000,00
12 => 00000012,00
987456,456 => 000987456,46
So something like myDecimal.ToString("D9") together with .ToString("F2").

View 3 Replies

Detect Culture Of Number Period Or Comma For Decimal Point / Thousands Separator?

Jul 1, 2011

In VB.Net, is there a way of auto-detecting the culture of a string representation of a number? I'll explain the situation:Our asp.net web site receives xml data feeds for boat data. Most of the time, the number format for the prices use either a simple non-formatted integer e.g. "999000". That's easy for us to process.Occaisionally, there are commas for thousands separators and periods for the decimal point. Also, that's fine as our data import understands this. Example "999,000.00".We're starting to get some data from France where some of the prices have been entered with the periods and thousands separators the other way around as that's the way it's done in many European countries. E.g. "999.000,00". This is where our system would interpret that as nine hundred and ninety nine pounds instead of the nine hundred and ninety nine thousand pounds that was intended.

View 2 Replies

Convert A Decimal ( Decimal Place Holder = Dot) To A Decimal (decimal Place Holder =comma)?

Dec 20, 2010

how do you convert a decimal ( decimal place holder = dot) to a decimal (decimal place holder =comma)?

View 6 Replies

NumberBox Format - Showing One Decimal Point?

Apr 23, 2012

Can I format it to show one decimal point? eg, 206.6. I noticed this custom toolbox item has Format.

View 7 Replies

Showing A Percentage In Decimal Form Using A Label

Aug 19, 2009

Im trying to make a Basic Program with a Progress Bar. Showing Visual Representation of a Percentage. I would like the Percentage to be shown as a decimal value as well. [Code] But since i do not know how to show decimal places i can not get this to create the correct value thus having a pointless progress bar and label. [Code]

View 3 Replies

After Converting All Degrees-->decimal, And Decimal-->hours - Use Tan, Cos And Sin Formula

Aug 27, 2009

After converting all degrees-->decimal, and decimal-->hours, how can i use Tan, Cos and Sin formula in vb.net? I want the user must enter an input (which it is a coordinat-->i already convert the degrees-->decimal value as suggested by stanav and paul.

The questions like this (i only calculate on paper but dont know how to implement in code):

Input user need to enter:
-latitude local (e.g. 1.4875)
-longitude local (e.g. 103.3883333)

[CODE]...

View 23 Replies

Change Decimal To A Comma When Hitting Decimal Key On Numpad Only

Jan 17, 2011

My user requests to change the . on the numpad to a when entering text in a multiline textbox.So I was thinking about the KeyDown event.To determine if the numpad . was pressed I can do something like this [code]But now how do I change the returned charachter as a , ? All e.Key... properties are ReadOnly. The KeyPress events let me change this by providing e.KeyChar, but in that event I can't check for the numpad .

View 2 Replies

Rounding Up Decimal Numbers To The Nearest 2 Decimal Places?

Apr 17, 2010

How would I go about rounding up decimal numbers to the nearest 2 decimal places? For example $7.0000032 would be $7.01 In theory, VB would make it $7.00 but if it is > $7.00, I want it to reflect that to the nearest penny... so $3.0000001 would be $3.01

View 5 Replies

.net - Dim X As Decimal = 100.0m Do A Cast From Double To Decimal Implicitly?

Mar 30, 2011

If I have the code:Dim x as Decimal = 100.0m

Is it casting from a double to a decimal implicitly. How would I do this explicitly in vb.net?

View 2 Replies

Form Decimal To Textbox, From Text Box To Decimal

Dec 21, 2010

1) One Decimal Varibale stores a decimal value

2) The value must be converted in string ( some time the comma is used as decimalplaceholder some time the dot)

3) the user modifies the value

4) i need to riconvert the string back in decimal

how can i do this

so:

Variable 123.34D ----> textBox 123,34 or 123.34 -----> variable 123.34D

View 3 Replies

Decimal Variable With 40 Decimal Places?

Apr 23, 2010

Is there a way in VB .NET to have a decimal variable with 40 decimal places?

View 3 Replies

Two Decimal And Three Decimal Rounded Numeric Value

Dec 2, 2010

Maybe this is just a really basic question that everyone knows the answer to, and is why I couldn't find the answer. What I want to do is pretty simple. I want to declare a custom type that's just like a Single, except when you access the value, you get the value rounded to the second or third decimal place. Something like this:

Dim MyNumer as TwoDecimalNumber
MyNumer = 1.124
Msgbox(MyNumber) 'This would pop up a box showing "1.12"

[Code]....

View 8 Replies

When Adding A Value To Another Value The Results Eventually Change From 2-decimal Places To Multiple Decimal Places?

Mar 13, 2009

Problem: Using the sub routing below, when adding a value to another value the results eventually change from 2-decimal places to multiple decimal places.Basically, the amount stored should always only be 2 decimal places, because the values passed in are always 2 decimal places. Output from calling the sub routine multiple times.

Running total = 329430.75
New Withheld Amount = 710.79
Running total = 330141.54

[code]....

As a workaround, I have a new routine that uses a custom round function to properly store only 2 decimal places - as the VB round function does not perform the type of rounding desired.I understand that we are removing the value from the dictionary and adding it back..

View 2 Replies

Format Number To Hower Many Number On Left Of Decimal And 1 Decimal Without Rounding?

Jul 28, 2010

format number to hower many number on left of decimal and 1 decimal without rounding

View 2 Replies

Split String On Multi-char Separator And Maintain Separator

Jul 31, 2009

Using VB.NET - I have a string:

"##RES00012##Some value ##RES00034##Another value"

That I want to split using the "##RES" as a seperator to:

"##RES00012## Some value " and "##RES00034## Another value"

The string.split function doesn't seem to offer an overload to split on multiple characters or array of characters and maintain the seperator, which is required for functional purposes.

I'm looking at simply searching for indexOf("##res") and using string manipulation to do this unless I'm missing something obvious? I've searched SO for a solution but unable to find anything that actually does what I'm after.

The following is the closest i've found: how-do-i-split-a-string-by-a-multi-character-delimiter-in-c

View 1 Replies

Allow Only 2 Decimal Points?

Jun 19, 2011

In window textbox, I'd like to just allow 2 decimal points only. I could set text box only numeric but don't know how to limit 2 decimal points.[code]...

View 3 Replies

Asp.net - Trailing Zero On Decimal

Nov 16, 2010

I have a string which looks like this 512.3 is there a way to add a trailing zero so it looks like this 512.30 Just to clarify (sorry I didn't know there where different ways etc.) My string is an amount which is passed so changes all the time I only need the trailing zero on amounts like 512.3, 512.4,512.5 etc. as some of my amounts will pass values like 512.33 and 512.44 and so on

View 4 Replies

Convert BCD To Decimal?

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

Decimal Places In Vb 08?

Oct 24, 2009

I am trying to write a code for a curency convertor.The result from multiplying the amount by the exchange has to be to 2 decimal places in order to convert it into Pounds and Pence.

Dim Currency As String
Dim Exchange As Decimal
Dim Amount As Integer
Dim Result As Decimal
Currency = txtCurrency.Text
Exchange = txtExchange.Text
Amount = txtAmount.Text
Result = Amount * Exchange
lblOutputMessage.Text = Result

Mod Edit: When you are posting code please use code tags like this.

View 2 Replies

Decimal To Hex Conversion?

Jul 9, 2009

i have 2 textbox's 1 button and im trying to convert the text in one textbox(decimal) to show a hex value in the other textbox via the button click event

View 3 Replies

Formating A Decimal Value?

Jan 8, 2011

Using VB.NET 2010 I don't know, how I can format a decimal as wanted...

Example:

Value = 1 / Wanted Format = 0100
Value = 2,5 / Wanted Format = 0250
Value = 24,25 / Wanted Format = 2425

View 3 Replies

Get The Second Decimal Point?

Mar 23, 2011

How to get the second decimal point?

View 7 Replies

Hexadecimal To Decimal?

Aug 11, 2011

im using vb 2010 and currently working on a program that senses and displays values in hexadecimal, i have already done this part, but now im required to convert the value that is in the textbox, for example 006d to 109.

View 12 Replies

How To Mix Decimal Places

Feb 22, 2012

Using Visual Studio I'm using TextRange processing a word at a time, parsing for figures and minus values etc. All of which works. However I have to honour the original number of decimal places in the figures, even though they may be 0's.ie -1219.0 and 1219.00 are both valid inputs the valid outputs would be(1,219.0) and 1,219.00, I can't just use tostring and stamp all of them as "N2" etc).I have to format including retaining the trailing 0 if necessary.I can use "#,##0.######" but that removes trailing 0's... ie both above example would be changed to 1,219 pos or neg.

View 2 Replies

Set Right Or Decimal In A Rchtextbox.

May 1, 2009

How would one set a right and a decimal tab for a richtextbox.

View 1 Replies

Specify The Decimal Rounded To?

Apr 1, 2009

I'm working on a calculator application and one function is to find midpoints on a cartesian coordinate system. I have inputs for two x and two y coordinates , and the program calculates the midpoints of both and prints them in a text box as a new set of coordinates. The points are represented by doubles to allow decimal and negative points, but I want to round the final coordinates to 1 decimal place. e.g: (12.5, 9.8) Math.Round would work, except that it only seems to be able to round to a whole number. e.g: (12, 10)

Is there any way to specify how many decimal places Math.Round rounds to, or is there another function that could acheive this result?

[code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved