void grid_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int[]          rows           = grid.Selection.GetSelectionRegion().GetRowsIndex();
            SNMPChannelImp chan           = (SNMPChannelImp)grid[rows[0], gridColName].Tag;
            string         oldname        = chan.Name;
            List <string>  forbiddenNames = new List <string>();

            for (int i = 1; i < grid.RowsCount; i++)
            {
                if (i != rows[0])
                {
                    forbiddenNames.Add(grid[i, gridColName].DisplayText);
                }
            }
            List <string> stations = new List <string>();

            for (int i = 1; i < agentGrid.RowsCount; i++)
            {
                stations.Add(((SNMPAgent)agentGrid[i, agentGridColName].Tag).Name);
            }
            ModifyChannelForm mcc = new ModifyChannelForm(chan, forbiddenNames, stations, null);

            if ((chan = mcc.DoShow()) != null)
            {
                showChannel(rows[0], chan);
                grid.Invalidate();
            }
            else
            {
                return;
            }
        }
        private void OnAddVariable(object sender, EventArgs e)
        {
            if (agentGrid.RowsCount > 1)
            {
                string var = GetUniqueVariableName();
                string statname;
                int [] sel = agentGrid.Selection.GetSelectionRegion().GetRowsIndex();
                if (sel.GetLength(0) > 0)
                {
                    if (sel[0] > 1)
                    {
                        statname = agentGrid[sel[0], agentGridColName].DisplayText;
                    }
                    else
                    {
                        statname = agentGrid[1, agentGridColName].DisplayText;
                    }
                }
                else
                {
                    statname = agentGrid[1, agentGridColName].DisplayText;
                }

                int[]         rows           = grid.Selection.GetSelectionRegion().GetRowsIndex();
                List <string> forbiddenNames = new List <string>();
                for (int i = 1; i < grid.RowsCount; i++)
                {
                    if (rows.Length > 0)
                    {
                        if (i != rows[0])
                        {
                            forbiddenNames.Add(grid[i, gridColName].DisplayText);
                        }
                    }
                    else
                    {
                        forbiddenNames.Add(grid[i, gridColName].DisplayText);
                    }
                }
                List <string> stations = new List <string>();
                for (int i = 1; i < agentGrid.RowsCount; i++)
                {
                    stations.Add(((SNMPAgent )agentGrid[i, agentGridColName].Tag).Name);
                }

                SNMPChannelImp    ch  = (SNMPChannelImp)ChannelFactory.CreateChannel(var, plugin, typeof(int), statname, "");
                ModifyChannelForm mcc = new ModifyChannelForm(ch, forbiddenNames, stations, statname);
                if ((ch = mcc.DoShow()) != null)
                {
                    AddVariable(ch);
                }
            }
            else
            {
                MessageBox.Show(StringConstants.CannotCreateVariable, StringConstants.Error);
            }
        }