Example #1
0
        private void btnAddToClientList_Click(object sender, EventArgs e)
        {
            if (dataGridViewHostInformation.SelectedRows.Count == 1)
            {
                frmNewClient frm = new frmNewClient();
                frm.Owner = this;
                frm.FillObject(dataGridViewHostInformation.SelectedRows[0].Cells["IP"].Value.ToString(),
                               dataGridViewHostInformation.SelectedRows[0].Cells["Name"].Value.ToString(),
                               dataGridViewHostInformation.SelectedRows[0].Cells["HostName"].Value.ToString());
                frm.ShowDialog();
                frm.Dispose();
            }
            else
            {
                foreach (DataGridViewRow dataGridViewRow in dataGridViewHostInformation.SelectedRows)
                {
                    AddNewClient(dataGridViewRow.Cells["IP"].Value.ToString(),
                                 dataGridViewRow.Cells["Name"].Value.ToString());
                }
            }


            //if (dataGridViewHostInformation.SelectedRows.Count > 0)
            //  AddNewClient(dataGridViewHostInformation.SelectedRows[0].Cells["IP"].Value.ToString(), dataGridViewHostInformation.SelectedRows[0].Cells["HostName"].Value.ToString());
            //
        }
Example #2
0
        private void dataGridClients_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (dataGridClients.SelectedCells.Count > 0)
            {
                frmNewClient frm = new frmNewClient();
                frm.Owner = this;

                ClientInfo ClientInfoTemp = null;
                foreach (ClientInfo CurrClient in SCUtility.m_AppDef.ArrClients)
                {
                    if (CurrClient.IP.CompareTo(dataGridClients.SelectedRows[0].Cells["IP"].Value.ToString()) == 0)
                    {
                        ClientInfoTemp = CurrClient;
                    }
                }

                if (ClientInfoTemp != null)
                {
                    frm.FillObject(ClientInfoTemp);
                    frm.ShowDialog();
                    frm.Dispose();
                }
            }
        }