J
Jerry
Hi All,
I want to fill some textbox with properties from Active Directory. The fact
is if the property is unavailable the program will crash. You can prevent
this by using a try and catch. So far, so good. Now I want to fill 'allot' of
text boxes. Doing a try and all the statements ending with a catch gives me
the problem that the rest of the statement will not be checked. So how can I
check every statement in one try catch 'loop' without using a separate try
catch for each?
For example:
Try
txtVoornaam.Text = usr.FirstName
txtInitialen.Text = usr.initials
txtAchternaam.Text = usr.LastName
Catch ex As Exception
End Try
Will stop executing if "txtVoornaam.Text = usr.FirstName" will give an
error, while it should check out the next two statements. I can do this:
Try
txtVoornaam.Text = usr.FirstName
Catch ex As Exception
End Try
Try
txtInitialen.Text = usr.initials
Catch ex As Exception
End Try
Etc.
But it's allot of code given that I have 20 of those.
Anyone can help me it will be appreciated?
I want to fill some textbox with properties from Active Directory. The fact
is if the property is unavailable the program will crash. You can prevent
this by using a try and catch. So far, so good. Now I want to fill 'allot' of
text boxes. Doing a try and all the statements ending with a catch gives me
the problem that the rest of the statement will not be checked. So how can I
check every statement in one try catch 'loop' without using a separate try
catch for each?
For example:
Try
txtVoornaam.Text = usr.FirstName
txtInitialen.Text = usr.initials
txtAchternaam.Text = usr.LastName
Catch ex As Exception
End Try
Will stop executing if "txtVoornaam.Text = usr.FirstName" will give an
error, while it should check out the next two statements. I can do this:
Try
txtVoornaam.Text = usr.FirstName
Catch ex As Exception
End Try
Try
txtInitialen.Text = usr.initials
Catch ex As Exception
End Try
Etc.
But it's allot of code given that I have 20 of those.
Anyone can help me it will be appreciated?