TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
bijan
NA
1
0
How to catch a Custom Control's exception within my form?!
Jan 16 2009 6:10 AM
Hi ppl
My question might seem a little bit newbie, which is why I called a newbie in this area ;)
See, I wrote a custom control, which holds couple of textboxes, I want an error message to be shown if the submit button is pressed but some of the textboxes are empty. I wrote a throw exception for it and I wanted to show it via an errorProvider component, which I found is impossible to implement within a Custom Control, it should only be used within a form!
So, I just decided to catch that exception that the custom control throws, in the form that actually implements it. But to my dispair, I don't know where to write my try, catch block.
I tried enclosing InitializeCompoent() in it:
[code]
try
{
InitializeComponent();
}
catch (NullEntryException ex)
{
MessageBox.Show("damn");
}
[/code]
but it doesn't work. I also tried to put the line that actually instantiates my custom control inside it:
[code]
try
{
this.addClientUserControl1 = new Presentation.Clients.addClientUserControl();
}
catch (NullEntryException ex)
{
}
[/code]
but it doesn't work either! What can I do?
Reply
Answers (
0
)
dynamic search
Retrieve an ID after record insertion