0

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.

enter image description here

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?

sara brown
  • 1,057
  • 8
  • 29
  • 46
  • Why did you comment out the code that clears `listView1.Items`? – Kent Sep 11 '12 at 04:31
  • i just trying an error. even i am using listView1.Items.Clear() it still works the same. it keep showing the same data that were sent before. do you have solution for this? – sara brown Sep 11 '12 at 07:03

0 Answers0