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(); ?
}
Re: Get the Exception Error as string in try{} catch{} 80 80

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(); ?
}
Re: Get the Exception Error as string in try{} catch{} 80 80
try { ... throw("error") }
catch { const char *err)
Re: Get the Exception Error as string in try{} catch{} 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.