I have created a task managment application and I wanted to implement the ability for 2-users to chat about specific task.
In Form1
I have a timer that
Firstly you are creating a new instance of Form14
every time you have a new message.
Secondly Show
and ShowDialog
do two very different things:
Show just displays the form, whereas ShowDialog displays the form as a modal dialog. This means the user can't do anything else until they dismiss the form.
You need to have a single instance of the form and you can use the Visible
property to determine whether it's shown or not. So you would have:
private Form14 frm14;
Then in the constructor:
frm14 = new Form14();
Then in your code:
if (!frm14.Visible)
{
// Add the message
frm14.Show();
} else{
// Top
frm14.BringToFront();
}
Try making form14 a member of form1. When you get a new message check the Visible property of forom14 to know if it is already showing.