Form not returning DialogResult because of matTextBox as psw with data
See original GitHub issueHi,
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:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s very interesting. Thanks for reporting, I’ll take a look at it
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.