This project is read-only.

SQLExpressionDialog without DialogResult on OK Button

Jun 6, 2012 at 2:48 PM


I am using this form in my app and want to set this code:

If qd.DialogResult = Windows.Forms.DialogResult.OK Then


 If Not [String].IsNullOrWhiteSpace(qd.Expression)  







but the result is always Cancel anyhow I click on the OK or Cancel Button

Now i saw in the sorce the DialogResult is not set for the OK Button.


// btnCancel
            resources.ApplyResources(this.btnCancel, "btnCancel");
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            // cmdOk
            resources.ApplyResources(this.cmdOk, "cmdOk");
            this.cmdOk.Name = "cmdOk";
            this.cmdOk.UseVisualStyleBackColor = true;
            this.cmdOk.Click += new System.EventHandler(this.cmdOk_Click);
Jun 6, 2012 at 5:06 PM

To what form does qd refer?

Jun 6, 2012 at 7:36 PM

Dim qd As SQLExpressionDialog = New SQLExpressionDialog

from DotSpatial.Symbology.Forms

You can see at the new Demo Map from DotSpatial 1.2 the same problem.

If you enter an expression in the dialog and click Cancel the same happens as you click OK, the query is executed.

This is the code from FindFeaturePlugin the DialogResult is not used here.

SQLExpressionDialog qd = new SQLExpressionDialog();
            if (fl.DataSet.AttributesPopulated)
                qd.Table = fl.DataSet.DataTable;
                qd.AttributeSource = fl.DataSet;

            // Note: User must click ok button to see anything.

            if (!String.IsNullOrWhiteSpace(qd.Expression))
                catch (SyntaxErrorException ex)
                    MessageBox.Show("The syntax of that query isn't quite right: " + ex.Message);
Jun 6, 2012 at 10:08 PM

Sorry, I just noticed the title of the discussion. 


You will find this is fixed in the latest changeset (67477).