Search Results

Search found 51 results on 3 pages for 'numberformat'.

Page 1/3 | 1 2 3  | Next Page >

  • When using the getInstance() method of the abstract java.text.NumberFormat class, what is the actual

    - by iamchuckb
    This question expands upon the one at abstract-class-numberformat-very-confused-about-getinstance. I feel that this question is different enough to merit being asked on its own. In the answers to that question, it was stated that a code statement such as NumberFormat en = NumberFormat.getInstance(Locale.US); returns an object that is a subclass of the java.text.NumberFormat class. It makes sense to me why the return type can't be just an instance of NumberFormat since that is an abstract class. Rather, it was stated that the returned object is at least an instance of NumberFormat, but actually something else. My question is this: what specifically is the class of the object that is returned? In the Sun documentation the only subclasses I see are ChoicesFormat and DecimalFormat. Is there some sort of behind the scenes compiler voodoo going on here? Thanks in advance!

    Read the article

  • C# CultureInfo NumberFormat NumberDecimalSeparator Problem

    - by Mahdi
    I want to change NumberDecimalSeparator of my application from "." to "/". it works when i show float numbers in my textbox. but integer types are not shown at all. I modify thread's culture to get application-wide formatting. my code is like this: CultureInfo ci = new CultureInfo("fa-IR", true); ci.NumberFormat.DigitSubstitution = DigitShapes.NativeNational; ci.NumberFormat.NumberDecimalSeparator = "/"; Thread.CurrentThread.CurrentCulture = ci; result: 3.14 = "3/14" 100 = "" Any help please ?

    Read the article

  • abstract class NumberFormat - very confuse about getInstance()

    - by Alex
    Hi, I'm new to Java and I have a beginner question: NumberFormat is an abstract class and so I assume I can't make an instance of it. But there is a public static (factory?) method getInstance() that allow me to do NumberFormat nf = NumberFormat.getInstance(); I'm quite confuse. I'll be glad if someone could give me hints on: 1) If there is a public method to get an instance of this abstract class, why don't we have also a constructor? 2) This is an abstract class ; how can we have this static method giving us an instance of the class? 3) Why choosing such a design? If I assume it's possible to have an instance of an abstract class (???), I don't get why this class should be abstract at all. Thank you.

    Read the article

  • abstract class NumberFormat - very confused about getInstance()

    - by Alex
    Hi, I'm new to Java and I have a beginner question: NumberFormat is an abstract class and so I assume I can't make an instance of it. But there is a public static (factory?) method getInstance() that allow me to do NumberFormat nf = NumberFormat.getInstance(); I'm quite confuse. I'll be glad if someone could give me hints on: 1) If there is a public method to get an instance of this abstract class, why don't we have also a constructor? 2) This is an abstract class ; how can we have this static method giving us an instance of the class? 3) Why choosing such a design? If I assume it's possible to have an instance of an abstract class (???), I don't get why this class should be abstract at all. Thank you.

    Read the article

  • Can you get access to the NumberFormatter used by ICU MessageFormat

    - by Travis
    This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand. When using the MesssageFormat class, is it possible to get access to the NumberFormat object it uses to format currency strings. When you create a NumberFormat instance yourself, you can specify attributes like precision and rounding used when creating currency strings. I have an issue where for the South Korean locale ("ko_KR"), the MessageFormat class seems to create currency strings w/ rounding (100.50 - ?100). In areas where I use NumberFormat directly, I set setMaximumFractionDigits and setMinimumFractionDigits to 2 but I can't seem to set this in the MessageFormat. Any ideas?

    Read the article

  • ChoiceFormat.setChoices confusion about format parameter type and documentation

    - by polygenelubricants
    From the java.text.ChoiceFormat API: setChoices(double[] limits, String[] formats): Set the choices to be used in formatting. Parameters: limits - contains [...] formats - are the formats you want to use for each limit. They can be either Format objects or Strings. When formatting with object Y, if the object is a NumberFormat, then ((NumberFormat) Y).format(X) is called. Otherwise Y.toString() is called. I'm having difficulties understanding the documentation for the formats parameter: how can you possibly pass a Format/NumberFormat object to setChoices if it's declared String[] formats? Note that interestingly, the getters counterpart of setChoices are declared as follows: double[] getLimits() Object[] getFormats() -- not String[]!!! Is this a bug in the API? Should the setter have been declared setChoices(double[], Object[]) instead, or am I not understanding how to use setChoices correctly?

    Read the article

  • android numberformat exception

    - by asifkt
    my application shows this number format exception errror while running. 1 0-22 11:09:06.095: WARN/System.err(290): at java.lang.Long.parseLong(Long.java:330) 10-22 11:09:06.095: WARN/System.err(290): at java.lang.Long.parseLong(Long.java:307) 10-22 11:09:06.105: WARN/System.err(290): at com.htc.socialnetwork.facebook.FacebookUtils.getSyncInterval(FacebookUtils.java:54) 10-22 11:09:06.105: WARN/System.err(290): at com.htc.socialnetwork.facebook.remote.FacebookReceiver.getSyncInterval(FacebookReceiver.java:269) 10-22 11:09:06.105: WARN/System.err(290): at com.htc.socialnetwork.facebook.remote.FacebookReceiver.onReceive(FacebookReceiver.java:196) 10-22 11:09:06.105: WARN/System.err(290): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2751) 10-22 11:09:06.105: WARN/System.err(290): at android.app.ActivityThread.access$3100(ActivityThread.java:126) 10-22 11:09:06.105: WARN/System.err(290): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1982) 10-22 11:09:06.105: WARN/System.err(290): at android.os.Handler.dispatchMessage(Handler.java:99) 10-22 11:09:06.105: WARN/System.err(290): at android.os.Looper.loop(Looper.java:123) 10-22 11:09:06.105: WARN/System.err(290): at android.app.ActivityThread.main(ActivityThread.java:4603) 10-22 11:09:06.105: WARN/System.err(290): at java.lang.reflect.Method.invokeNative(Native Method) 10-22 11:09:06.105: WARN/System.err(290): at java.lang.reflect.Method.invoke(Method.java:521) 10-22 11:09:06.105: WARN/System.err(290): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 10-22 11:09:06.105: WARN/System.err(290): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 10-22 11:09:06.115: WARN/System.err(290): at dalvik.system.NativeStart.main(Native Method) anybody please help me to get the reason for this error

    Read the article

  • Excel Range Format: Number is automatically formatted when Range::Value2 is set

    - by A9S6
    I have an Excel addin written in C# that imports a text file into Excel worksheet. Some of the fields in the file are text and some oare numbers. Problem Steps: Change the System's Regional Settings to Dutch (Belgium) Open Excel and import the file into Excel. Records contain values such as 78,1118 which gets converted to 781.118. Note that in Dutch(Belgium), COMMA is the decimal character and DOT is the thousand character. I do not require the number to be formatted automatically but just want to display whatver I get from the file (78,1118). If I set the cell's NumberFormat to "@" i.e. Text, then it displays an error (SmartTag) saying "Number stored as Text". I know I can change the settings by going to the "Options" box but I dont want to change any user options in Excel for this. I have tried setting the cell's Value2 with an "'" (apostrophe) but the same error is displayed. If I set the cell's format to something else after the value is set then the actual value changes and I loose the decimal. Is there a way in Excel to just display the value and NOT display the "Number Stored as Text" error in cell?

    Read the article

  • ICU MessageFormat Currency Value Precison Lost

    - by Travis
    This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand. When using the MesssageFormat class, why for a certain locale (Korea "ko"KR" for example) does it round currency values (e.g. 100.50 becomes ?101). For most locales (such as the US "en_US"), the precision of the argument passed in remains untouched (e.g. 100.50 becomes $100.50). I thought this might be a default rounding issue that some locales have (Swiss Francs "fr_CH" for example have a default 0.05 rounding) but South Korea "ko_KR" has none. Any ideas?

    Read the article

  • Ab Initio - Formatting a number in Left alignment

    - by Veera
    I have a requirement in Ab Initio to format a number in left alignment. I shouldn't be using String conversion (as Strings are left aligned by default), as it might cause compatibility problems in the other end. For example, if my Field has 7 bytes length, and I'm getting only two digits as my input, then these two digits should go into the first two bytes of my field (left aligned), instead of the last two bytes. So, is there any in-built function in Ab Initio, that can format a number as left aligned?

    Read the article

  • Java NumberFormatException

    - by Bragaadeesh
    Hi, I am trying to do a conversion of a String to integer for which I get a NumberFormatException. The reason is pretty obvious. But I need a workaround here. Following is the sample code. public class NumberFormatTest { public static void main(String[] args) { String num = "9.18E+09"; try{ long val = Long.valueOf(num); }catch(NumberFormatException ne){ //Try to convert the value to 9180000000 here } } } I need the logic that goes in the comment section, a generic one would be nice. Thanks.

    Read the article

  • setlocale to fr-FR in PHP and number formatting

    - by bateman_ap
    Hi, I am trying to create a French version of one of my sites. I have set setlocale(LC_ALL, 'fr_FR'); at the top of my page, and using strftime I am displaying dates correctly in the French style. However I am having some problems with a number. Part of the page uses data I am getting from a Web Service. I am assigning a returned value to a var like this: $overallRating = $returnArray['Overall']; I am then using the following code later to format it to 1 decimal place number_format($overallRating,1) In the English version the overallRating value might be 7.5 and returns a value such as 7.5 (the reason for running it through the number_format is if it returns 7 I want it to display 7.0) However in the French version if I print out the raw $overallRating value I get 7,5 which looks like it has translated it into french. This would be fine but if I run it through number_format I get the error: Notice: A non well formed numeric value encountered in /sites/index.php on line 250 Line 250 is the number_format line I presume the translation to 7,5 is messing it up, but not sure how to solve this... Using PHP 5.3 in case there is anything new that helps me

    Read the article

  • How to prefix a positive number with plus sign in PHP

    - by user318466
    I need to design a function to return negative numbers unchanged but should add a + sign at the start of the number if its already no present. Example: Input Output ---------------- +1 +1 1 +1 -1 -1 It will get only numeric input. function formatNum($num) { # something here..perhaps a regex? } This function is going to be called several times in echo/print so the quicker the better.

    Read the article

  • How to display Currency in Indian Numbering Format in PHP

    - by Somnath Muluk
    I have a question about formatting the Rupee currency (Indian Rupee - INR). For example, numbers here are represented as: 1 10 100 1,000 10,000 1,00,000 10,00,000 1,00,00,000 10,00,00,000 Refer Indian Numbering System I have to do with it PHP. I have saw this question Displaying Currency in Indian Numbering Format. But couldn't able to get it for PHP my problem. Update: How to use money_format() in indian currency format?

    Read the article

  • DecimalFormat and Double.valueOf()

    - by folone
    Hello. I'm trying to get rid of unnecessary symbols after decimal seperator of my double value. I'm doing it this way: DecimalFormat format = new DecimalFormat("#.#####"); value = Double.valueOf(format.format(41251.50000000012343)); But when I run this code, it throws: java.lang.NumberFormatException: For input string: "41251,5" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224) at java.lang.Double.valueOf(Double.java:447) at ... As I see, Double.valueOf() works great with strings like "11.1", but it chokes on strings like "11,1". How do I work around this? Is there a more elegant way then something like Double.valueOf(format.format(41251.50000000012343).replaceAll(",", ".")); Is there a way to override the default decimal separator value of DecimalFormat class?

    Read the article

  • php add thousandseperator without adjusting comma

    - by bobwah
    I'm looking for a way to use the php number_format function or something similar that will add the thousand seperator but will leave any decimal part of the number intatct without and formatting of this. For example: 39845.25843 = 39,845.25843 347346.8 = 347,346.8 1000000 = 1,000,000 Thanks

    Read the article

  • Refactoring FizzBuzz

    - by MarkPearl
    A few years ago I blogger about FizzBuzz, at the time the post was prompted by Scott Hanselman who had podcasted about how surprized he was that some programmers could not even solve the FizzBuzz problem within a reasonable period of time during a job interview. At the time I thought I would give the problem a go in F# and sure enough the solution was fairly simple – I then also did a basic solution in C# but never posted it. Since then I have learned that being able to solve a problem and how you solve the problem are two totally different things. Today I decided to give the problem a retry and see if I had learnt anything new in the last year or so. Here is how my solution looked after refactoring… Solution 1 – Cheap and Nasty public class FizzBuzzCalculator { public string NumberFormat(int number) { var numDivisibleBy3 = (number % 3) == 0; var numDivisibleBy5 = (number % 5) == 0; if (numDivisibleBy3 && numDivisibleBy5) return String.Format("{0} FizzBuz", number); else if (numDivisibleBy3) return String.Format("{0} Fizz", number); else if (numDivisibleBy5) return String.Format("{0} Buz", number); return number.ToString(); } } class Program { static void Main(string[] args) { var fizzBuzz = new FizzBuzzCalculator(); for (int i = 0; i < 100; i++) { Console.WriteLine(fizzBuzz.NumberFormat(i)); } } } My first attempt I just looked at solving the problem – it works, and could be an acceptable solution but tonight I thought I would see how far  I could refactor it… The section I decided to focus on was the mass of if..else code in the NumberFormat method. Solution 2 – Replacing If…Else with a Dictionary public class FizzBuzzCalculator { private readonly Dictionary<Tuple<bool, bool>, string> _mappings; public FizzBuzzCalculator(Dictionary<Tuple<bool, bool>, string> mappings) { _mappings = mappings; } public string NumberFormat(int number) { var numDivisibleBy3 = (number % 3) == 0; var numDivisibleBy5 = (number % 5) == 0; var mappedKey = new Tuple<bool, bool>(numDivisibleBy3, numDivisibleBy5); return String.Format("{0} {1}", number, _mappings[mappedKey]); } } class Program { static void Main(string[] args) { var mappings = new Dictionary<Tuple<bool, bool>, string> { { new Tuple<bool, bool>(true, true), "- FizzBuzz"}, { new Tuple<bool, bool>(true, false), "- Fizz"}, { new Tuple<bool, bool>(false, true), "- Buzz"}, { new Tuple<bool, bool>(false, false), ""} }; var fizzBuzz = new FizzBuzzCalculator(mappings); for (int i = 0; i < 100; i++) { Console.WriteLine(fizzBuzz.NumberFormat(i)); } Console.ReadLine(); } } In my second attempt I looked at removing the if else in the NumberFormat method. A dictionary proved to be useful for this – I added a constructor to the class and injected the dictionary mapping. One could argue that this is totally overkill, but if I was going to use this code in a large system an approach like this makes it easy to put this data in a configuration file, which would up its OC (Open for extensibility, closed for modification principle). I could of course take the OC principle even further – the check for divisibility by 3 and 5 is tightly coupled to this class. If I wanted to make it 4 instead of 3, I would need to adjust this class. This introduces my third refactoring. Solution 3 – Introducing Delegates and Injecting them into the class public delegate bool FizzBuzzComparison(int number); public class FizzBuzzCalculator { private readonly Dictionary<Tuple<bool, bool>, string> _mappings; private readonly FizzBuzzComparison _comparison1; private readonly FizzBuzzComparison _comparison2; public FizzBuzzCalculator(Dictionary<Tuple<bool, bool>, string> mappings, FizzBuzzComparison comparison1, FizzBuzzComparison comparison2) { _mappings = mappings; _comparison1 = comparison1; _comparison2 = comparison2; } public string NumberFormat(int number) { var mappedKey = new Tuple<bool, bool>(_comparison1(number), _comparison2(number)); return String.Format("{0} {1}", number, _mappings[mappedKey]); } } class Program { private static bool DivisibleByNum(int number, int divisor) { return number % divisor == 0; } public static bool Divisibleby3(int number) { return number % 3 == 0; } public static bool Divisibleby5(int number) { return number % 5 == 0; } static void Main(string[] args) { var mappings = new Dictionary<Tuple<bool, bool>, string> { { new Tuple<bool, bool>(true, true), "- FizzBuzz"}, { new Tuple<bool, bool>(true, false), "- Fizz"}, { new Tuple<bool, bool>(false, true), "- Buzz"}, { new Tuple<bool, bool>(false, false), ""} }; var fizzBuzz = new FizzBuzzCalculator(mappings, Divisibleby3, Divisibleby5); for (int i = 0; i < 100; i++) { Console.WriteLine(fizzBuzz.NumberFormat(i)); } Console.ReadLine(); } } I have taken this one step further and introduced delegates that are injected into the FizzBuzz Calculator class, from an OC principle perspective it has probably made it more compliant than the previous Solution 2, but there seems to be a lot of noise. Anonymous Delegates increase the readability level, which is what I have done in Solution 4. Solution 4 – Anon Delegates public delegate bool FizzBuzzComparison(int number); public class FizzBuzzCalculator { private readonly Dictionary<Tuple<bool, bool>, string> _mappings; private readonly FizzBuzzComparison _comparison1; private readonly FizzBuzzComparison _comparison2; public FizzBuzzCalculator(Dictionary<Tuple<bool, bool>, string> mappings, FizzBuzzComparison comparison1, FizzBuzzComparison comparison2) { _mappings = mappings; _comparison1 = comparison1; _comparison2 = comparison2; } public string NumberFormat(int number) { var mappedKey = new Tuple<bool, bool>(_comparison1(number), _comparison2(number)); return String.Format("{0} {1}", number, _mappings[mappedKey]); } } class Program { static void Main(string[] args) { var mappings = new Dictionary<Tuple<bool, bool>, string> { { new Tuple<bool, bool>(true, true), "- FizzBuzz"}, { new Tuple<bool, bool>(true, false), "- Fizz"}, { new Tuple<bool, bool>(false, true), "- Buzz"}, { new Tuple<bool, bool>(false, false), ""} }; var fizzBuzz = new FizzBuzzCalculator(mappings, (n) => n % 3 == 0, (n) => n % 5 == 0); for (int i = 0; i < 100; i++) { Console.WriteLine(fizzBuzz.NumberFormat(i)); } Console.ReadLine(); } }   Using the anonymous delegates I think the noise level has now been reduced. This is where I am going to end this post, I have gone through 4 iterations of the code from the initial solution using If..Else to delegates and dictionaries. I think each approach would have it’s pro’s and con’s and depending on the intention of where the code would be used would be a large determining factor. If you can think of an alternative way to do FizzBuzz, add a comment!

    Read the article

  • java - BigDecimal

    - by Mk12
    I was trying to make my own class for currencies using longs, but Apparently I should use BigDecimal (and then whenever I print it just add the $ sign before it). Could someone please get me started? What would be the best way to use BigDecimals for Dollar currencies, like making it at least but no more than 2 decimal places for the cents, etc. The api for BigDecimal is huge, and I don't know which methods to use. Also, BigDecimal has better precision, but isn't that all lost if it passes through a double? if I do new BigDecimal(24.99), how will it be different than using a double? Or should I use the constructor that uses a String instead? EDIT: I decided to use BigDecimals, and then use: private static final java.text.NumberFormat moneyt = java.text.NumberFormat.getCurrencyInstance(); { money.setRoundingMode(RoundingMode.HALF_EVEN); } and then whenever I display the BigDecimals, to use money.format(theBigDecimal). Is this alright? Should I have the BigDecimal rounding it too? Because then it doesn't get rounded before it does another operation.. if so, could you show me how? And how should I create the BigDecimals? new BigDecimal("24.99") ? Well, after many comments to Vineet Reynolds (thanks for keeping coming back and answering), this is what I have decided. I use BigDecimals and a NumberFormat. Here is where I create the NumberFormat instance. private static final NumberFormat money; static { money = NumberFormat.getCurrencyInstance(Locale.CANADA); money.setRoundingMode(RoundingMode.HALF_EVEN); } Here is my BigDecimal: private final BigDecimal price; Whenever I want to display the price, or another BigDecimal that I got through calculations of price, I use: money.format(price) to get the String. Whenever I want to store the price, or a calculation from price, in a database or in a field or anywhere, I use (for a field): myCalculatedResult = price.add(new BigDecimal("34.58")).setScale(2, RoundingMode.HALF_EVEN); .. but I'm thinking now maybe I should not have the NumberFormat round, but when I want to display do this: System.out.print(money.format(price.setScale(2, RoundingMode.HALF_EVEN); That way to ensure the model and things displayed in the view are the same. I don't do: price = price.setScale(2, RoundingMode.HALF_EVEN); Because then it would always round to 2 decimal places and wouldn't be as precise in calculations. So its all solved now, I guess. But is there any shortcut to typing calculatedResult.setScale(2, RoundingMode.HALF_EVEN) all the time? All I can think of is static importing HALF_EVEN... EDIT: I've changed my mind a bit, I think if I store a value, I won't round it unless I have no more operations to do with it, e.g. if it was the final total that will be charged to someone. I will only round things at the end, or whenever necessary, and I will still use NumberFormat for the currency formatting, but since I always want rounding for display, I made a static method for display: public static String moneyFormat(BigDecimal price) { return money.format(price.setScale(2, RoundingMode.HALF_EVEN)); } So values stored in variables won't be rounded, and I'll use that method to display prices.

    Read the article

  • Java add leading zeros to a number....

    - by user69514
    I need to return a string in the form xxx-xxxx where xxx is a number and xxxx is another number, however when i have leading zeros they disappear. I'm trying number formatter, but it's not working. public String toString(){ NumberFormat nf3 = new DecimalFormat("#000"); NumberFormat nf4 = new DecimalFormat("#0000"); if( areaCode != 0) return nf3.format(areaCode) + "-" + nf3.format(exchangeCode) + "-" + nf4.format(number); else return exchangeCode + "-" + number; } } I figured it out: public String toString(){ NumberFormat nf3 = new DecimalFormat("000"); NumberFormat nf4 = new DecimalFormat("0000"); if( areaCode != 0) //myFormat.format(new Integer(someValue)); return nf3.format(new Integer(areaCode)) + "-" + nf3.format(new Integer(exchangeCode)) + "-" + nf4.format(new Integer(number)); else return nf3.format(new Integer(exchangeCode)) + "-" + nf4.format(new Integer(number)); }

    Read the article

  • How to parse kanji numeric characters using ICU?

    - by Aki
    I'm writing a function using ICU to parse an Unicode string which consists of kanji numeric character(s) and want to return the integer value of the string. "?" = 5 "???" = 31 "???????" = 5972 I'm setting the locale to Locale::getJapan() and using the NumberFormat::parse() to parse the character string. However, whenever I pass it any Kanji characters, the parse() method is returning U_INVALID_FORMAT_ERROR. Does anyone know if ICU supports Kanji character strings in the NumberFormat::parse() method? I was hoping that since I'm setting the Locale to Japanese that it would be able to parse Kanji numeric values. Thanks! #include <iostream> #include <unicode/numfmt.h> using namespace std; int main(int argc, char **argv) { const Locale &jaLocale = Locale::getJapan(); UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(jaLocale, status); UChar number[] = {0x4E94}; // Character for '5' in Japanese '?' UnicodeString numStr(number); Formattable formattable; nf->parse(numStr, formattable, status); if (U_FAILURE(status)) { cout << "error parsing as number: " << u_errorName(status) << endl; return(1); } cout << "long value: " << formattable.getLong() << endl; }

    Read the article

  • Exception in thread "main" java.lang.NoClassDefFoundError

    - by Manu
    package pack; public class sample{ public static void main(String input[]) { NumberFormat numberFormat = new DecimalFormat("#,##0.00##"); System.out.println(numberFormat.format(44533125.00)); } } the code is working fine in the current dir.. (c:/myprogram/). after that i copy the sample.class file and paste it in other dir(d:/myprogram). i got error while running, like " Exception in thread "main" java.lang.NoClassDefFoundError: sample (wrong name: pack/sample)" In java .class file can run anywhere right? but why i am not able to run?

    Read the article

  • How do you link a time stamp to a cell using a userform button control? [migrated]

    - by Chad Cochrane
    Hello fellow VB Developers/Users/Hobbyists/What-Have-You! I have a user form that has two buttons: 1. Start 2. Stop When I press start, I would like it to record the current time with this format: (dd/mm/yy hh:nn:ss:) in a specific column. Then when I press the Stop Button I would like it to record the time again in the cell next to it. Then if I press start Again I would like it to record below the first cells current record. Basically I am building a timer to record data to see how long certain tasks take. I will post the excel file and provide more information were necessary. Thanks for any help provided. CURRENT CODE Public runTimer As Double Public startTime As Date Dim counter As Date Sub setStart() counter = 0 startTime = Now runTimer = Now + TimeSerial(0, 0, 1) Application.OnTime runTimer, "setStart", , True Set myTime = Sheet4.Range("F1") Set timeRng = Sheet4.Range("C8:C100") i = WorksheetFunction.CountA(timeRng) i = i + 1 Cells(i, "C") = myTime Sheet4.Cells(i, "C").NumberFormat = "yyyy/mm/dd HH:mm:ss" If i >= 2 Then Cells(i, "D8") = Cells(i, "C8") - Cells(i - 1, "C8") Sheet4.Cells(i, "C").NumberFormat = "yyyy/mm/dd HH:mm:ss" End If Application.EnableEvents = False End Sub Sub setStop() Application.OnTime runTimer, "setStop", , True Set myTime = Sheet4.Range("F1") Set timeRng = Sheet4.Range("D8:D100") i = WorksheetFunction.CountA(timeRng) i = i + 1 Application.EnableEvents = False Cells(i, "D") = myTime Sheet4.Cells(i, "D").NumberFormat = "yyyy/mm/dd HH:mm:ss" End Sub

    Read the article

  • Application hangs after changing language From “En-Us” to any global language in control panel

    - by user1764824
    I created a WinForms application using C#. When I try to change the culture info, my application gets hanged. Microsoft.Win32.SystemEvents.UserPreferenceChanged += new Microsoft.Win32.UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged); void SystemEvents_UserPreferenceChanged(object sender, Microsoft.Win32.UserPreferenceChangedEventArgs e) { if (!PreviousInstance()) { CultureInfo ObjCulture = new CultureInfo(CultureInfo.InvariantCulture.IetfLanguageTag, false); Thread.CurrentThread.CurrentCulture = ObjCulture; Application.CurrentCulture = ObjCulture; } } public void INIT() { CultureInfo objCultureInfo = null; try { objCultureInfo = new CultureInfo("en-US", false); objCultureInfo.NumberFormat.NumberDecimalSeparator = "."; objCultureInfo.NumberFormat.NegativeSign = "-"; objCultureInfo.NumberFormat.NumberNegativePattern = 1; //1 stands for -100. Application.CurrentCulture = objCultureInfo; } } After Changing Language ... My Application gets Hanged and i cant Debug anything When i Try to Evaluate things This Event Called only once.. But if try in a small application it comes every time when Language is changed... ... Nothing shown in Eventviewer either. How can I solve this problem? ..

    Read the article

  • Cannot Find Symbol Method?

    - by Aaron
    In my driver program, This line gives me cannot find symbol error and I don't know why, the method is clearly defined in the SavingsAccount class, and I can refer to all other methods in my driver program but just not that one, I tried changing the type to double, and etc but still not working. Refer to ** Account acct2 = new SavingsAccount (name); acct2.calculateBalance(); SavingsAccount Class Inherited from Account Class: public class SavingsAccount extends Account { private final short minBalance = 0; private double overdraftFee; private double yearlyInterestRate = 0.02; private double interestAmount; public SavingsAccount (String name) { super(name); } public double withdraw (double amount) { if (accountBalance - amount >= minBalance) { accountBalance -= amount; System.out.print ("Withdraw Successful"); } else { accountBalance -= amount; overdraftFee = accountBalance * (0.10); accountBalance += overdraftFee; System.out.print ("Withdraw Succesful, however overdraft fee of 10% has been applied to your account"); } return accountBalance; } **public void calculateBalance () { interestAmount = (accountBalance * yearlyInterestRate); accountBalance += interestAmount; }** public String toString() { return super.toString() + " Interest Received: " + interestAmount; } } Account class, if needed import java.util.Random; import java.text.NumberFormat; public abstract class Account { protected double accountBalance; protected long accountNumber; protected String accountHolder; public Account (String name) { accountHolder = name; accountBalance = 0; Random accountNo = new Random(); accountNumber = accountNo.nextInt(100000); } public double deposit (double amount) { accountBalance += amount; return accountBalance; } public String toString() { NumberFormat accountBal = NumberFormat.getCurrencyInstance(); return "Account Balance: " + accountBal.format(accountBalance) + "\nAccount Number: " + accountNumber; } public String getAccountHolder() { return accountHolder; } public double getAccountBalance() { return accountBalance; } public abstract double withdraw (double amount); }

    Read the article

1 2 3  | Next Page >