Reputation: 5349
When ever i assign the selected value from my combo box my Winforms application wont close via the controlBox
(Minimise, Maximise work but close does not!)
If i comment out the following code it seems to work:
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dataSet1.NewSelectCommand' table. You can move, or remove it, as needed.
this.newSelectCommandTableAdapter.Fill(this.dataSet1.NewSelectCommand);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string databaseName = string.Empty;
databaseName = comboBox1.SelectedItem.ToString();
}
Upvotes: 0
Views: 330
Reputation: 2171
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string databaseName = string.Empty;
if(comboBox1.SelectedItem != null) databaseName = comboBox1.SelectedItem.ToString();
}
Upvotes: 2