|
|||||||
New to SitePoint Forums? Register here for free!
|
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Non-Member
![]() ![]() Join Date: Aug 2004
Location: Star Trek Voyager
Posts: 193
|
QUICK HELP: C#.Net Syntax Error
Hey, I need some help on this piece of code.
Overview: I created a wizard program, the wizard pages are included in a sperate DLL file which my project has references too, all controls on the wizard pages have their modifiers set to public. I have no problem communicating with the wizard pages from my application, however I'm getting an error in this section when trying to read all the controls at once. Code:
foreach (TextBox tbValidate in DbWizPage1.Controls)
{
if (tbValidate.Tag == "Required")
{
if (tbValidate.Text == string.Empty)
{
DbWizPage1.errorProvider1.SetError(tbValidate,"Required Field");
}
else
{
DbWizPage1.errorProvider1.SetError(tbValidate, "");
}
}
}
I keep getting an invalid cast error on the first line. If there is another solution I would be open to it. There are about 30 controls on page one, and many more on additional pages. I don't want to have to include code to check every single field, that would just be insane. I had a lovely idea of taging the controls as required, checking the entire collection and disreguarding the contorls not required, but it dosen't like my method I guess. Site point once again dose not allow formatting of code samples since it completely destroyed it again... wish they'd fix that bug. Thanks, Everyone |
|
|
|
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 00:35.









Threaded Mode