1

I created an application which contains two numeric textboxes to which I've added an StartValue property.

Example

public decimal SValue {
  get { return MValue; }
  set { MValue = value; }
}

then

const string VALUE = "1.000";
private NumericTextBox sVal;

Problem comes here

sVal.StartValue = Convert.ToDecimal(VALUE);

After I change the language in Control panel from EN-US to any global language my application hangs.

DmitryG
  • 17,677
  • 1
  • 30
  • 53
user1764824
  • 9
  • 1
  • 3
  • Because for some culture it is comma instead of the decimal which is the seprator and when you use Convert it relies on the current culture, suggest using a Parse with an invariant culture option – V4Vendetta Oct 22 '12 at 09:18
  • Sir how to solve this..If i put Current culture in my thread also it shows... Can u help me in this – user1764824 Oct 22 '12 at 09:20
  • 1
    I meant try something like `decimal.Parse(VALUE,CultureInfo.InvariantCulture)` – V4Vendetta Oct 22 '12 at 09:22
  • 3
    Why use a `string` as the `VALUE`? Why not just use a `decimal` to start with and avoid the need to Convert/Parse it? – musefan Oct 22 '12 at 09:26
  • @ V4Vendetta Thanks sir... Problem solved.. :) – user1764824 Oct 22 '12 at 10:01

0 Answers0