How is it possible to get the Exception Error as a string in the catch event ?
The thing is that I get an exception and now want to know what the problem is and what the exception is saying.

try
{
    //some code
}

catch(Exception ex)
{
   //How to display this Exception as a string in MessageBox::Show(); ?
}

Found a solution:

String^ GetException= ex2->ToString();
MessageBox::Show(GetException);

How is it possible to get the Exception Error as a string in the catch event ?
The thing is that I get an exception and now want to know what the problem is and what the exception is saying.

try
{
    //some code
}

catch(Exception ex)
{
   //How to display this Exception as a string in MessageBox::Show(); ?
}
try { ... throw("error") }
catch { const char *err)

try
{
int ....;
cout << "" << balances[k] << endl;
}
catch(string err)
{
cout << "" << err << edl;
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.