コード例 #1
0
        private void ButtonSearchPart_Click(object sender, EventArgs e)
        {
            if (TextBoxSearchPart.Text == "")
            {
                MessageBox.Show("Please enter the name of the part to be searched.");
            }
            else
            {
                string x     = TextBoxSearchPart.Text;
                int    count = 0;

                for (int j = 0; j < Inventory.MyPartList.Count; j++)
                {
                    if (Inventory.MyPartList[j].Name.Equals(x))
                    {
                        DataGridViewPartsAvailable.ClearSelection();
                        DataGridViewPartsAvailable.Rows[j].Selected = true;
                        count++;
                    }
                }

                if (count < 1)
                {
                    MessageBox.Show("Part Name not found exactly as searched.(Case Sensitive)");
                }
            }
        }
コード例 #2
0
 private void Display()
 {
     DataGridViewPartsAvailable.AutoGenerateColumns = false;
     DataGridViewPartsInProduct.AutoGenerateColumns = false;
     DataGridViewPartsAvailable.DataSource          = Inventory.MyPartList;
     DataGridViewPartsInProduct.DataSource          = associatedParts;
     DataGridViewPartsAvailable.ClearSelection();
     DataGridViewPartsInProduct.ClearSelection();
 }