Esempio n. 1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     libbrhscgui.Components.InputResult ipt = objUI.showInputForm("Enter Search Term", "Search");
     if (ipt.txt == "!cancel=user")
     {
         return;
     }
     else if (string.IsNullOrEmpty(ipt.txt))
     {
         MessageBox.Show("Nothing was entered", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else
     {
         foreach (DataGridViewRow row in dgvMain.Rows)
         {
             foreach (DataGridViewCell c in row.Cells)
             {
                 if (c.Value.ToString().ToLower().Contains(ipt.txt.ToLower()))
                 {
                     dgvMain.CurrentCell = c;
                     return;
                 }
             }
         }
         MessageBox.Show("Could not find '" + ipt.txt + "'", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 2
0
 private void btnGoToLine_Click(object sender, EventArgs e)
 {
     libbrhscgui.Components.InputResult ipt = objUI.showInputForm("Enter Row Number", "Go To Row");
     if (ipt.txt == "!cancel=user")
     {
         return;
     }
     else if (string.IsNullOrEmpty(ipt.txt))
     {
         MessageBox.Show("Nothing was entered", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else if (!int.TryParse(ipt.txt, out int r))
     {
         MessageBox.Show("Specified Value is not numeric", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         foreach (DataGridViewRow row in dgvMain.Rows)
         {
             if (dgvMain.Rows.IndexOf(row) == (Convert.ToInt32(ipt.txt) - 1))
             {
                 dgvMain.CurrentCell = row.Cells[0];
                 return;
             }
         }
         MessageBox.Show("Could not find row '" + ipt.txt + "'", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }