TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Muhammed Riyaaz
NA
7
2.7k
Opening Window form using timer?
May 10 2013 8:07 AM
Process:
I am having a table
s.no ID_1 ID_2 content
1 1001 4001 Hi
2 1002 4002 Hello
I used timer to bind this table in gridview of windows form
using the same timer i checked whether there is any content for the _ID2 from the table.
If the content value is true a new window form should be displayed.
Issue facing:
Each and every time the timer gets load it displaying the new windows even it is opened for the same _ID already how to check the form is open for the _ID which is opened already?
My code:
private void timer1_Tick(object sender, EventArgs e)
{
try
{
string Msg = string.Empty;
int Suc;
string tmpSuc = string.Empty;
string i;
string Role = Form1.role.ToString().Trim();
XmlNode Node;
int tmpSid;
string tmpChat = string.Empty;
wsTestService.STUDENTS_ONLINE(Role, out Node, out Msg, out Suc);
DataTable dt = new DataTable();
dt.Columns.Add("Students_Name", typeof(string));
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Status", typeof(string));
foreach (XmlNode node in Node)
{
DataRow dr = dt.NewRow();
dr["Students_Name"] = node["Name"].InnerText;
Student_Name = Convert.ToString(dr["Students_Name"]);
dr["ID"] = node["ID"].InnerText;
tmpSid = Convert.ToInt32(dr["ID"]);
string chtdtm = "MM-d-yyyy";
string date;
wsTestService.CHAT_RECEIVE_MESSAGE(tmpSid, Tutor_ID, out tmpChat, out date, out tmpSuc);
DateTime today = DateTime.Today;
//chtdtm = Convert.ToDateTime(chtdtm);
string tmpdate;
tmpdate = today.ToString(chtdtm);
if (tmpChat != string.Empty)
{
if (tmpdate == date)
{
do
{
Chat_Box_Test objCTB = new Chat_Box_Test();
Chatting = tmpChat;
objCTB.Show();
} while (Student_ID == tmpSid);
}
}
//Chatting = tmpChat;
Student_ID = tmpSid;
i = node["Status"].InnerText;
if (i == "true")
{
dr["Status"] = "online";
}
else
{
dr["Status"] = "offline";
}
dt.Rows.Add(dr);
}
dataGridView1.DataSource = dt;
}
catch (Exception)
{
throw;
}
}
Reply
Answers (
0
)
how to turn off outlook security warning dialog box using C#
Where are static constructors used?