i am making a form using c# which it will shows up the data send by android. In order to make it more convenient to use, i am using timer flicker for every minutes. This will make the form auto-update.
however, the flicker is a bit annoyed when it displayed the same data that were sent before. The form suppose shows only when the user click SENT button and this data will not redundantly displayed like the picture below.
this is my code for the form
private void button6_Click(object sender, EventArgs e){
//retrieved data sent by android using ip address
do
{
for (int i = 0; i <= _server.Q.NoOfItem - 1; i++)
{
String words = _server.Q.ElementAtBuffer(i).ToString();
String[] berjaya = words.Split(new char[] { ',', '[', ']', ' ' });
listView1.Items.Clear();
listviewitem = new ListViewItem(berjaya[13]);//eta
listviewitem.SubItems.Add(berjaya[1]);//prio
listviewitem.SubItems.Add("777");//ambulansID
listviewitem.SubItems.Add("16/08/2012");//date
this.listView1.Items.Add(listviewitem);
listView1.FullRowSelect = true;
//show header
listView1.View = View.Details;
}
//do the timer flicker that been set for every minutes
private void timer1_Tick_1(object sender, EventArgs e)
{
button6_Click(sender, e);
}
this code firstly will retrieved the data send by android using IP address with for (int i = 0; i <= _server.Q.NoOfItem - 1; i++)
. next i split the data and displayed it to its own listviewitem. This data will automatically updated every one minute and it suppose shows only the new data that been sent by user and it will not be redundant. Does anyone knows how to fix this?