Exemple #1
0
        public void AddNewEntry(string entry)
        {
            //this.watchList.ClearSelection();
            if (frm == null)
            {
                frm = new AddWatchForm();
                Form1StringResources.SetTextForAllControls(frm);
            }
            frm.EditValue = entry;
            int i = 0;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrEmpty(entry))
                {
                    if (this.watchList.Rows[0].Cells[0].Value == null)
                    {
                        i = 0;
                    }
                    else
                    {
                        this.watchList.Rows.Insert(0, 1); i = 0;
                        //i = this.WdataGridView1.Rows.Count-1;
                    }
                    if (this.watchList.Rows.Count == 1)
                    {
                        this.watchList.Rows.Insert(0, 1);
                    }
                }
                else
                {
                    i = this.watchList.SelectedRows[0].Index;
                }
                if (frm.EditValue != "")
                {
                    this.watchList.Rows[i].Cells[0].Value = frm.EditValue;
                }
                else
                {
                    this.watchList.Rows[i].Cells[0].Value = null;
                }
                RefreshRow(i);
            }
        }
 public void AddNewEntry(string entry)
 {
 	//this.watchList.ClearSelection();
 	if (frm == null)
 	{
 		frm = new AddWatchForm();
 		Form1StringResources.SetTextForAllControls(frm);
 	}
 	frm.EditValue = entry;
 	int i=0;
 	if (frm.ShowDialog() == DialogResult.OK)
 	{
 		if (string.IsNullOrEmpty(entry))
 		{
 		if (this.watchList.Rows[0].Cells[0].Value == null) i = 0;
 		else 
 		{
 			this.watchList.Rows.Insert(0,1); i=0;
 			//i = this.WdataGridView1.Rows.Count-1;
 		}
 		if (this.watchList.Rows.Count == 1) 
 			this.watchList.Rows.Insert(0,1);
 		}
 		else 
 			i = this.watchList.SelectedRows[0].Index;
 		if (frm.EditValue != "")
 		this.watchList.Rows[i].Cells[0].Value = frm.EditValue;
 		else
 		this.watchList.Rows[i].Cells[0].Value = null;
 		RefreshRow(i);
 	}
 }