private void getDetails(int id) { MySqlDataReader reader = adapter.casadeshowDetailsReader(id); if (reader != null) { while (reader.Read()) { textBoxIdCasadeShow.Text = reader.GetString(14); textBoxNomeCasaDeShow.Text = reader.GetString(2); maskedTextBoxContatoCasaDeShow.Text = reader.GetString(3); textBoxDescricaoCasaDeShow.Text = reader.GetString(4); textBoxEndLogradouroCasaDeShow.Text = reader.GetString(5); int index = comboBoxEndTipoCasaDeShow.Items.IndexOf(reader.GetString(6)); comboBoxEndTipoCasaDeShow.SelectedItem = comboBoxEndTipoCasaDeShow.Items[index]; textBoxEndNumeroCasaDeShow.Text = reader.GetString(7); try { textBoxEndComplementoCasaDeShow.Text = reader.GetString(8); } catch (System.Data.SqlTypes.SqlNullValueException) { textBoxEndComplementoCasaDeShow.Text = ""; } textBoxEndBairroCasaDeShow.Text = reader.GetString(9); maskedTextBoxEndCepCasaDeShow.Text = reader.GetString(10); comboBoxEndCidadeCasaDeShow.SelectedValue = reader.GetInt32(11); try { comboBoxIdRestauranteCasaDeShow.SelectedItem = comboBoxIdRestauranteCasaDeShow.Items[reader.GetInt32(18)]; checkBoxContemRestaurante.Checked = true; } catch (System.Data.SqlTypes.SqlNullValueException) { checkBoxContemRestaurante.Checked = false; } int indexDia = comboBoxDiaFechamento.Items.IndexOf(reader.GetString(15)); Console.WriteLine(indexDia + " " + reader.GetString(15)); comboBoxDiaFechamento.SelectedItem = comboBoxDiaFechamento.Items[indexDia]; //textBoxDiaFechamentoCasaDeShow.Text = reader.GetString(12); textBoxHoraInicioCasaDeShow.Text = reader.GetString(16); } } }