Question

When will a text box leave Leave its control? Write a simple code for textbox Leave. e) 2) Write about Exception and Exceptio
0 0
Add a comment Improve this question Transcribed image text
Answer #1

c) The text box leave Leave its control when it validates the text entered in the text box.

Simple code for text box leave

private void textBox1_Leave(object sender, EventArgs e)

{

if(textBox1.Text="")// checks the text box is empty or not

{

MessageBox.Show("The text is empty enter text to leave this text box");//informs the user about the problem

textBox1.focus();

}

}

2)

Exception is nothing but an event which occurs during the run time of the program which affects the normal execution of the program.In other words it is the error occurrence during the running time of the command.

Exception Handling

When an run time error occurs the program completely gets failed and no more execution happens.To overcome this problem we can perform exception handling .It except the code which cause run time error and executes the remaining code.

3)

Let us consider a try and catch block

When the error occurs it goes to the catch block and the error is catch.So the remaining code gets executed

In try block it will be found out there is no error so it does not go to catch block after try block remainihg code gets executed

Only if error occurs the code goes to catch block  

Add a comment
Know the answer?
Add Answer to:
When will a text box leave Leave its control? Write a simple code for textbox Leave. e) 2) Write about Exception and Exception handling? (2 marks) 3) When there is an error in the code the contro...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT