sYnced Posted July 8, 2013 at 02:57 PM Report #517655 Posted July 8, 2013 at 02:57 PM Boa tarde comunidade, já tentei de várias formas, mas como ando a usar MDI parent não me dá erro nenhum, apenas me abre o outro form ou até mesmo nenhum... if (comboBox1.SelectedIndex < 0) { MessageBox.Show("Erro\r\nSelecione Utilizador."); } else { int i = comboBox1.SelectedIndex; ClienteGestao cli = (ClienteGestao)dados[i]; TextWriter txt = new StreamWriter("id.txt"); txt.WriteLine(i); this.Close(); } O código é esse acima, já tentei de tudo (o ficheiro existe) está tudo operacional o que é necessário para escrever, só não me está a escrever no ficheiro (desta maneira não dá qualquer tipo de anómalia apenas não escreve).
nelsonr Posted July 8, 2013 at 03:03 PM Report #517657 Posted July 8, 2013 at 03:03 PM Tenta fechar o txt antes de fechares o form. Ou então usa o Using using(TextWriter txt = new StreamWriter("id.txt")) { txt.WriteLine(i); }
sYnced Posted July 8, 2013 at 03:05 PM Author Report #517658 Posted July 8, 2013 at 03:05 PM vou testar, obrigado 🙂 Resultou obrigado!
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