How to use ErrorProvider with the SQL Text Editor (WinForms)?
Last modified:
public partial class Form1 : Form { public Form1() { InitializeComponent(); queryBuilder1.SyntaxProvider = new MSSQLSyntaxProvider(); queryBuilder1.MetadataContainer.LoadFromXMLFile("Northwind.xml"); } private void plainTextSQLBuilder1_SQLUpdated(object sender, EventArgs e) { sqlTextEditor1.Text = plainTextSQLBuilder1.SQL; } private void sqlTextEditor1_Validating(object sender, System.ComponentModel.CancelEventArgs e) { try { queryBuilder1.SQL = sqlTextEditor1.Text; } catch (SQLError exception) { e.Cancel = true; sqlTextEditor1.SetSelection(exception.ErrorPos.pos, exception.ErrorTokenValue.Length); errorProvider1.SetError(sqlTextEditor1, exception.Message); } } private void sqlTextEditor1_Validated(object sender, EventArgs e) { errorProvider1.SetError(sqlTextEditor1, ""); } }