Click here to Skip to main content
15,916,215 members
Home / Discussions / C#
   

C#

 
AnswerRe: Plotting point in circle button Pin
Mycroft Holmes4-Jun-09 1:08
professionalMycroft Holmes4-Jun-09 1:08 
QuestionListview item persisting problem Pin
Narsimha094-Jun-09 0:53
Narsimha094-Jun-09 0:53 
AnswerRe: Listview item persisting problem Pin
Henry Minute4-Jun-09 2:39
Henry Minute4-Jun-09 2:39 
GeneralQuad Tree Pin
gabeold4-Jun-09 0:46
gabeold4-Jun-09 0:46 
GeneralRe: Quad Tree Pin
Pete O'Hanlon4-Jun-09 0:50
mvePete O'Hanlon4-Jun-09 0:50 
GeneralRe: Quad Tree Pin
gabeold4-Jun-09 0:59
gabeold4-Jun-09 0:59 
QuestionHow can I add multiple images in a field (suppose row=2, col = 1) of a ListView control Pin
Md. Ali Naser Khan4-Jun-09 0:40
Md. Ali Naser Khan4-Jun-09 0:40 
AnswerRe: How can I add multiple images in a field (suppose row=2, col = 1) of a ListView control Pin
Mycroft Holmes4-Jun-09 1:04
professionalMycroft Holmes4-Jun-09 1:04 
QuestionAny replacement for FlowLayoutPanel? Pin
darrenlovejoy4-Jun-09 0:31
darrenlovejoy4-Jun-09 0:31 
Questionproblem with setup Pin
vijaylumar4-Jun-09 0:18
vijaylumar4-Jun-09 0:18 
AnswerRe: problem with setup Pin
Searril4-Jun-09 2:59
Searril4-Jun-09 2:59 
Questiontimers in listview [modified] Pin
snehanp3-Jun-09 23:37
snehanp3-Jun-09 23:37 
AnswerRe: timers in listview Pin
Christian Graus3-Jun-09 23:59
protectorChristian Graus3-Jun-09 23:59 
AnswerRe: timers in listview Pin
Rajesh R Subramanian4-Jun-09 0:00
professionalRajesh R Subramanian4-Jun-09 0:00 
AnswerRe: timers in listview Pin
Pete O'Hanlon4-Jun-09 0:11
mvePete O'Hanlon4-Jun-09 0:11 
GeneralRe: timers in listview Pin
snehanp4-Jun-09 0:43
snehanp4-Jun-09 0:43 
AnswerRe: timers in listview Pin
Pete O'Hanlon4-Jun-09 4:38
mvePete O'Hanlon4-Jun-09 4:38 
I knocked this quick sample together, and it should do what you want:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SimpleWinApp
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();

      _list.Add("Hello");
      _list.Add("There");
      _list.Add("What do you think");
      _list.Add("Hello");
      _list.Add("There");
      _list.Add("What do you think");
      _list.Add("Hello");
      _list.Add("There");
      _list.Add("What do you think");
      _list.Add("Hello");
      _list.Add("There");
      _list.Add("What do you think");
      _list.Add("Hello");
      _list.Add("There");
      _list.Add("What do you think");
      _list.Add("Hello");
      _list.Add("There");
      _list.Add("What do you think");

      int i = 0;
      foreach(string item in _list)
      {
        listView1.Items.Add(new ListViewItem(string.Format("{0}. {1}", i++, item)));
      }
    }

    private List<string> _list = new List<string>();
    private List<Timer> _timers = new List<Timer>();
    private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
    {
      // I'm going to add some code for the timer here.
      Timer timer = new Timer();
      timer.Interval = 1000;
      timer.Tag = e.Item;
      timer.Tick += new EventHandler(timer_Tick);
      timer.Start();
      _timers.Add(timer);
    }

    void timer_Tick(object sender, EventArgs e)
    {
      Timer timer = sender as Timer;
      if (timer != null)
      {
        timer.Stop();
        timer.Tick -= new EventHandler(timer_Tick);
        ListViewItem item = timer.Tag as ListViewItem;
        item.Remove();
        _timers.Remove(timer);
      }
    }
  }
}


"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



GeneralRe: timers in listview [modified] Pin
snehanp4-Jun-09 19:40
snehanp4-Jun-09 19:40 
GeneralRe: timers in listview Pin
Pete O'Hanlon5-Jun-09 1:15
mvePete O'Hanlon5-Jun-09 1:15 
Questionwindow MDI form Pin
Narsimha093-Jun-09 23:35
Narsimha093-Jun-09 23:35 
AnswerRe: window MDI form Pin
Rajdeep.NET3-Jun-09 23:48
Rajdeep.NET3-Jun-09 23:48 
GeneralRe: window MDI form Pin
Narsimha094-Jun-09 0:06
Narsimha094-Jun-09 0:06 
AnswerRe: window MDI form Pin
Mycroft Holmes4-Jun-09 0:58
professionalMycroft Holmes4-Jun-09 0:58 
QuestionHow to get a .Net Control of a web page in c# Pin
Yukivi3-Jun-09 23:20
Yukivi3-Jun-09 23:20 
AnswerRe: How to get a .Net Control of a web page in c# Pin
Henry Minute4-Jun-09 2:44
Henry Minute4-Jun-09 2:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.