salman mohammad

salman mohammad

  • NA
  • 13
  • 3.4k

Notify popup has been made

Mar 23 2018 5:15 AM
Notify popup has been made.But the thing is if any changes made in database simultaneously the updated message is not being displayed in the notification popup.
Can anyone help me get out of it?
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Tulpep.NotificationWindow;
using System.Data.SqlClient;
using System.Collections;
namespace NotificationPopup
{
public partial class NotificationPopup : Form
{
SqlCommand cmd;
SqlConnection con;
public NotificationPopup()
{
InitializeComponent();
}
PopupNotifier popup;
private void btnShow_Click(object sender, EventArgs e)
{
popup = new PopupNotifier();
popup.Image = Properties.Resources.notification;
popup.TitleText = "HELLO";
popup.ContentText = "WELCOME TO INDIA !";
popup.Popup();
}
ArrayList al;
int j;
private void timer1_Tick(object sender, EventArgs e)
{
if (j == 0)
{
con = new SqlConnection("Data Source=SALMAN\\SQLExpress;Database=MsDemo;Integrated Security=true");
cmd = new SqlCommand("SELECT Output FROM DemoOnPopup", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
al = new ArrayList();
while (dr.Read())
{
al.Add(dr[0].ToString());
i++;
}
}
popup = new PopupNotifier();
popup.Image = Properties.Resources.notification;
popup.BodyColor = Color.Yellow;
popup.ContentColor = Color.Black;
if (j<i)
popup.ContentText = al[j].ToString();
popup.Popup();
if (timer1.Interval==500)
popup.Hide();
j++;
if (j == i)
timer1.Stop();
}
int i;
private void NotificationPopup_Load(object sender, EventArgs e)
{
}
}
}
 

Answers (6)