Again dialog ... :(
-
Ok, thanks everyone, but I have one more question. To gett callback of my modal dialog I use this code: ModalDlgClass myDlg = new ModalDlgClass(); if(myDlg.ShowDialog() == DialogResult.OK) { //Do smf. } But in the modal dialog there is a small problem ... I need to check something before close it. if(textBox1.Text.Length == 0) { //cheking and need returf focus to modal dialog } else { //do smf else, then this.Close(); // I need 2 close it ONLY if textBox1 is not emty } But if my textBox1 is empty after checking modal dialog is closing ... is there any way not to close it? thanks ===================== http://wasp.elcat.kg
-
Ok, thanks everyone, but I have one more question. To gett callback of my modal dialog I use this code: ModalDlgClass myDlg = new ModalDlgClass(); if(myDlg.ShowDialog() == DialogResult.OK) { //Do smf. } But in the modal dialog there is a small problem ... I need to check something before close it. if(textBox1.Text.Length == 0) { //cheking and need returf focus to modal dialog } else { //do smf else, then this.Close(); // I need 2 close it ONLY if textBox1 is not emty } But if my textBox1 is empty after checking modal dialog is closing ... is there any way not to close it? thanks ===================== http://wasp.elcat.kg
Hello, the codegurus around the world.;) If you work for MFC, you will figure it out. Maybe, you just declare MyDialog_OnClose message method, and filter the textbox input. And, if there is no input, just return before the base class Close is called. Just put "return". I believe that this works. Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
-
Hello, the codegurus around the world.;) If you work for MFC, you will figure it out. Maybe, you just declare MyDialog_OnClose message method, and filter the textbox input. And, if there is no input, just return before the base class Close is called. Just put "return". I believe that this works. Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
I deed, but it, not working. I have modal dialog. And it's closing even if i put 'return'. Maybe it is becourse I click on button with 'OK' dialog properties? But is it only way to get response from my Modal dialog? ===================== http://wasp.elcat.kg
-
I deed, but it, not working. I have modal dialog. And it's closing even if i put 'return'. Maybe it is becourse I click on button with 'OK' dialog properties? But is it only way to get response from my Modal dialog? ===================== http://wasp.elcat.kg
Hello, the codegurus around the world.;) Oooops, you're right because I got the same result. So, I asked "HELP" of VC#. 1) Use DialogResult.NONE
protected void btnOK_Click (object sender, System.EventArgs e)
{
// OK button clicked.
// get new message.
strMessage = txtMessage.Text;if(strMessage == "") { MessageBox.Show(this, "Error"); DialogResult = DialogResult.None; }
}
- Disable OK button if TextBox is empty
private void Msg_TextChanged(object sender, System.EventArgs e)
{
if(txtMessage.Text == "")
btnOK.Enabled = false;
else
btnOK.Enabled = true;
}Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
-
Hello, the codegurus around the world.;) Oooops, you're right because I got the same result. So, I asked "HELP" of VC#. 1) Use DialogResult.NONE
protected void btnOK_Click (object sender, System.EventArgs e)
{
// OK button clicked.
// get new message.
strMessage = txtMessage.Text;if(strMessage == "") { MessageBox.Show(this, "Error"); DialogResult = DialogResult.None; }
}
- Disable OK button if TextBox is empty
private void Msg_TextChanged(object sender, System.EventArgs e)
{
if(txtMessage.Text == "")
btnOK.Enabled = false;
else
btnOK.Enabled = true;
}Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
Yah!!! thanks, Nice idea to lock button till text is empty! ;) ===================== http://wasp.elcat.kg
-
Ok, thanks everyone, but I have one more question. To gett callback of my modal dialog I use this code: ModalDlgClass myDlg = new ModalDlgClass(); if(myDlg.ShowDialog() == DialogResult.OK) { //Do smf. } But in the modal dialog there is a small problem ... I need to check something before close it. if(textBox1.Text.Length == 0) { //cheking and need returf focus to modal dialog } else { //do smf else, then this.Close(); // I need 2 close it ONLY if textBox1 is not emty } But if my textBox1 is empty after checking modal dialog is closing ... is there any way not to close it? thanks ===================== http://wasp.elcat.kg
I had to do this in VB.NET. What I did was I didn't "HardCode" the "Dialog Result Codes" into my Command Buttons. When the User clicked the "Login" Button of my Form, I would Validate the Login info, if it was Correct, I would just Type "Return DialogResult.OK", otherwise I would not return anything.