question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Form not returning DialogResult because of matTextBox as psw with data

See original GitHub issue

Hi,

I got another funny bug the last week. When your Form that you show with the method xxx.ShowDialog() contain a TextBox with the property password to true and if you have some text inside, you’ll never receive back the DialogResult in your parent

Steps : In your program.cs open a form like this

var form = new Form1();
var result = form.ShowDialog() == DialogResult.OK;

In your form, add a TextBox with the password property = true

If your TextBox contain any text when you call

this.DialogResult = DialogResult.OK/Cancel;
Close();

So your program will never get back the result.

The only workaround I find is to call something like materialTextBoxPassword.Text = string.Empty;

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
leocbcommented, Mar 9, 2020

That’s very interesting. Thanks for reporting, I’ll take a look at it

1reaction
TomsDev67commented, Mar 9, 2020

I’ve done some other tests.

It is working like a charm in 4.6.1 .NET project but not in 4.7.2 project (using in both MaterialSkin compiled in 4.6.1) I don’t know why but yeah. (It is an empty project in which I’ve reproduced the issue)

To complete test, I’ve tried with a TextBox from legacy Winform having the property “UseSystemPasswordChar” to true and no issue with this component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - ShowDialog doesn't return DialogResult
I made a form2 that shows and there are buttons which return DialogResult but I have no idea why this doesn't work:.
Read more >
Form.DialogResult Property (System.Windows.Forms)
If a Form is displayed as a modeless window, the value returned by the DialogResult property might not return a value assigned to...
Read more >
Button.DialogResult Property (System.Windows.Forms)
Gets or sets a value that is returned to the parent form when the button is clicked. ... The value assigned is not...
Read more >
C# - Make a dialog form and return data from it - YouTube
Way of gettting data from a second form to the mainform.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found