reznor Posted July 18, 2014 at 10:18 AM Report Share #562820 Posted July 18, 2014 at 10:18 AM (edited) Bom dia! Tenho vários forms de consulta que quando clico num botão ou numa row abrem um outro form de edição. O que eu preciso é de uma condição que não me deixe fechar o form de consulta enquanto o form edição estiver aberto. Alguém tem uma sugestão? Deixo aqui o código c# que uso para abrir a janela de edição após um duplo clique sobre a row: FormEditarCliente fed = new FormEditarCliente(); fed.MdiParent = this.MdiParent; fed.txtnumcli.Text = dataGridView1.Rows[e.RowIndex].Cells[1].FormattedValue.ToString(); fed.Show(); Edited July 18, 2014 at 10:19 AM by reznor Link to comment Share on other sites More sharing options...
nelsonr Posted July 18, 2014 at 12:32 PM Report Share #562833 Posted July 18, 2014 at 12:32 PM Boas, podes usar o .ShowDialog em vez do .Show Link to comment Share on other sites More sharing options...
reznor Posted July 18, 2014 at 04:23 PM Author Report Share #562846 Posted July 18, 2014 at 04:23 PM Boas Nelson! Não posso nada que ele não deixa :\ Link to comment Share on other sites More sharing options...
Pipo01 Posted July 20, 2014 at 01:26 PM Report Share #562891 Posted July 20, 2014 at 01:26 PM boas @reznor ve se este links tem algo que te ajude... http://social.msdn.microsoft.com/Forums/pt-BR/ab8a4393-c924-4ca3-84ad-8a908c9e15a6/fechar-windows-form-ao-iniciar-outro-form http://msdn.microsoft.com/pt-br/library/system.windows.forms.form.closing(v=vs.110).aspx http://ebstudio.ativo-forum.com/t69-c-botao-de-sair-fechar-uma-form Link to comment Share on other sites More sharing options...
nelsonr Posted July 20, 2014 at 03:12 PM Report Share #562894 Posted July 20, 2014 at 03:12 PM O problema está em atribuires o MDIParent. Se retirares essa linha já deves conseguir abrir. Se precisares mesmo de abrir atribuindo o MDIParent, podes ver se colocando o form como disabled faz o que pretendes (this.Enabled = false;), e voltas a ligar quando fechares o outro Link to comment Share on other sites More sharing options...
reznor Posted July 22, 2014 at 10:29 AM Author Report Share #563002 Posted July 22, 2014 at 10:29 AM boas @reznor ve se este links tem algo que te ajude... http://social.msdn.microsoft.com/Forums/pt-BR/ab8a4393-c924-4ca3-84ad-8a908c9e15a6/fechar-windows-form-ao-iniciar-outro-form http://msdn.microsoft.com/pt-br/library/system.windows.forms.form.closing(v=vs.110).aspx http://ebstudio.ativo-forum.com/t69-c-botao-de-sair-fechar-uma-form Obrigado mas as soluções não são compatíveis com aquilo que tenho :\ O problema está em atribuires o MDIParent. Se retirares essa linha já deves conseguir abrir. Se precisares mesmo de abrir atribuindo o MDIParent, podes ver se colocando o form como disabled faz o que pretendes (this.Enabled = false;), e voltas a ligar quando fechares o outro Funcionou Nélson! 😄 Obrigado! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now