![]() If ( ErrorProvider1->GetError( TextBox1 )->Equals( "" ) ) If there is no error, then open the dialog box. Void Button1_Click( System::Object^ sender, System::EventArgs^ e ) to check for an error before opening the dialog box. This method demonstrates using the ErrorProvider.GetError method OpenFileDialog1->InitialDirectory = TextBox1->Text Void TextBox1_LostFocus( Object^ sender, System::EventArgs^ e ) dialog's InitialDirectory property to the text in TextBox1. This method handles the LostFocus event for TextBox1 by setting the "Try again with a different directory." ) System::IO::DirectoryInfo^ directory = gcnew System::IO::DirectoryInfo( TextBox1->Text ) ĮrrorProvider1->SetError( TextBox1, "" ) ĮrrorProvider1->SetError( TextBox1, "Please enter a directory" ) Ĭatch ( System::IO::DirectoryNotFoundException^ )ĮrrorProvider1->SetError( TextBox1, "The directory does not exist." a DirectoryNotFoundException is caught. an ArgumentException is caught if an invalid directory is entered, System::ComponentModel::CancelEventArgs^ e ) Void TextBox1_Validating( Object^ sender, Ensure all events are associated with their event handlers. To run this example, paste the following code into a form containing a TextBox named TextBox1, an OpenFileDialog named OpenFileDialog1, a button named Button1, and an ErrorProvider named ErrorProvider1. Inline Coding Model in ASP.NET using VB.The following code example uses the GetError method to check for an error before opening a file dialog box.Working With Hidden Field Control In ASP.NET Using VB.NET.BulletedList and Bullet Style property in ASP.NET using VB.NET.Splash screen effects to your web application in ASP.NET using VB.NET.GridViewComplexHead in ASP.NET using VB.NET.Embed Flash Banner in ASP.NET page using VB.NET.Creating Text Files in ASP.NET using VB.NET.ASP.NET change selected color of the menu item using VB.NET.Check/Uncheck the GridView CheckBox in ASP.NET Using VB.NET.Highlight ASP.NET GridView Rows On Mouse Over Using VB.NET.ASP.NET validate DropDownList control using VB.NET. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |