private void okButton_Click(object sender, EventArgs e) { if (propertyInfo == null) propertyInfo = new Database.PropertyInfo(); propertyInfo.name = nameBox.Text; propertyInfo.policeVisibility = policeVisibility.Checked; this.DialogResult = DialogResult.OK; this.Close(); }
// ---------------------------------------------------------- private Database.PropertyInfo getCurrentProperty() { if (dataGridView.SelectedRows.Count != 1) { return null; } Database.PropertyInfo propertyInfo = new Database.PropertyInfo(); propertyInfo.id = Convert.ToUInt64(dataGridView.SelectedRows[0].Cells[0].Value); propertyInfo.name = Convert.ToString(dataGridView.SelectedRows[0].Cells[1].Value); propertyInfo.policeVisibility = Convert.ToBoolean(dataGridView.SelectedRows[0].Cells[2].Value); return propertyInfo; }