private void SelectPartToExport() { using (var dlg = new SelectBrickDialog()) { if (dlg.ShowDialog() == DialogResult.OK) { PartToExport = dlg.SelectedBrick; PartBrowseTextBox.Value = dlg.SelectedBrick.PartId.ToString(); PartNameLabel.Text = dlg.SelectedBrick.Description; UpdateCanExport(); } } }
private void PartBrowseTextBox_ValueChanged(object sender, EventArgs e) { if (PartToExport != null) { if (PartToExport.PartId.ToString() != PartBrowseTextBox.Value.Trim()) { PartToExport = null; } else { return; } } ValidateSelectedPartID(); }
private void ValidateSelectedPartID() { if (!int.TryParse(PartBrowseTextBox.Value, out int partID) && !string.IsNullOrEmpty(PartBrowseTextBox.Value)) { PartNameLabel.Text = "Invalid part ID"; PartNameLabel.ForeColor = Color.Red; } else { if (!string.IsNullOrEmpty(PartBrowseTextBox.Value)) { PartToExport = FindPartInfo(partID); } else { PartToExport = null; } UpdateSelectedPartDescription(); } UpdateCanExport(); }