none
Converting System::Decimal or Int32^ to int RRS feed

  • Question

  • Hi,

    I am having a problem trying to convert a value from a System.Windows.Forms.NumericUpDown.Value to an int. I have tryed a number of methods to cast the decimal in some way to an int, however it will not cast so easily.

    I have tryed the method NumericUpDown.Value::ToInt32, but even this is giving me an error, the error code mentions something to do with the CLR, 

    Does anyone know of a simple solution?
     
    Tuesday, July 8, 2008 3:39 PM

Answers

  •  
            System::Void numericUpDown1_ValueChanged(System::Object^  sender, System::EventArgs^  e) {  
                int value = Convert::ToInt32(numericUpDown1->Value);  
                label1->Text = value.ToString();  
            }  
     

    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Monday, July 14, 2008 1:36 AM
    Tuesday, July 8, 2008 4:16 PM
    Moderator