Re:Displaying child windows
-
hi can anybody let me know is it possible to display child windows using threads or delegates? thanks
-
hi can anybody let me know is it possible to display child windows using threads or delegates? thanks
-
hi can anybody let me know is it possible to display child windows using threads or delegates? thanks
RameshwerE wrote:
threads or delegates?
These are two utterly, totally different things. The latter is trivial, the former is a bad move. You should never interact with UI elements outside of the thread that created them, which should, logically, be your main thread.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
hi can anybody let me know is it possible to display child windows using threads or delegates? thanks
A simple way to do it using timer... it's like a thread via timer, is it useful to you ?
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Imaging; namespace OptionFormA { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { Timer t = new Timer(); t.Tick += new EventHandler(FormOpen); t.Start(); } private void FormOpen(object _sender, EventArgs eArgs) { SubFormA sfA = new SubFormA(); sfA.Visible = true; } } }
By AYR itsayr@gmail.com
-
hi can anybody let me know is it possible to display child windows using threads or delegates? thanks
But I have a question about if i want appear a form after pressing a button on main form and main form will disappear, and when press a button on child form the child form will disappear and the main form will appear ? Does anyone know how to do?
By AYR itsayr@gmail.com
-
But I have a question about if i want appear a form after pressing a button on main form and main form will disappear, and when press a button on child form the child form will disappear and the main form will appear ? Does anyone know how to do?
By AYR itsayr@gmail.com
just pass the main form to child form and then call Hide method of the main through child or before showing it (from the MainForm) and you can do that vice versa for showing main again and hiding child
namespace Test2
{public partial class MainForm : Form { ChildForm child; public MainForm() { InitializeComponent(); this.child = new ChildForm(this); } private void hideAndShowChld\_Click(object sender, EventArgs e) { this.Hide(); this.child.Show(); } } public partial class ChildForm : Form { MainForm main; public ChildForm(MainForm form) { InitializeComponent(); this.main = form; } private void button1\_Click(object sender, EventArgs e) { this.Hide(); this.main.Show(); } }
}
good luck