Try
{
Int s = int Parse (t1. text)
S = S + 1000;
MBS (S + “”);
}
EX: - Syntax errors
Interested in mastering .NET? Learn more about ".NET Training" in this blog post.
5.To work with exception handling .net introduced 4 keywords Try, Catch, finally and throw
Try{ --- --- --- -- }
Catch (Type of exception obj)
{ }
Catch (Type of exception obj)
{ }
Finally
{ }
Exception class Hierarchy
File not formatted exception
Invalid formatted exception
{
Try
{
Int S = int . Parse (text Box1.Text)
S =s + 1000;
Message Box. Show (“Salary is ” + s);
String [] X = new String []
{
“C #”, “VB”
};
Message Box. Show (X [0]);
Message Box. Show (X [1]);
Message Box. Show (X [2]);
}
//try Catch (Format Exception fe)
{
Message Box. Show ( fe. Message);
}
Catch (Exception cd)
{
Message Box. Show (ed. Message );
}
Finally
{
Message Box. Show (“From finally”);
}
Methods of directory class
Directory. Get Logical Drive () à returns all drive names. Directory. Get Directories (path) à returns all directory names. Directory. Get Files (path) à returns all files names.
String [] X = Directory . Get Logical Drives ();
For (int I = 0; I < x. length ; I ++)
Combo Box 1. Items . Add (X [1] )
à Code for combo Box 1 Selected Index changed event
List Box 1.Items . Clear ();
String P = Combo box 1. Selected Item . To string ();
Try
{
String [] x = Directory. Get Directories (p);
For (int I = 0; I < x. length ; I ++)
List box1. Items a Add (X[i]);
}
Catch (Io Exception)
{
Message Box. Show (I .e Message) ;
}
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.