private void getDetails(int id) { MySqlDataReader reader = adapter.hotelDetailsReader(id); if (reader != null) { while (reader.Read()) { textBoxIdHotel.Text = reader.GetString(0); try { comboBoxIdRestauranteHotel.SelectedItem = comboBoxIdRestauranteHotel.Items[reader.GetInt32(1)]; checkBoxContemRestaurante.Checked = true; } catch (System.Data.SqlTypes.SqlNullValueException) { checkBoxContemRestaurante.Checked = false; } textBoxNomeHotel.Text = reader.GetString(2); comboBoxCategoriaHotel.SelectedItem = comboBoxCategoriaHotel.Items[int.Parse(reader.GetString(3)[0] + "") - 1]; maskedTextBoxContatoHotel.Text = reader.GetString(4); int index = comboBoxEndTipoHotel.Items.IndexOf(reader.GetString(5)); comboBoxEndTipoHotel.SelectedItem = comboBoxEndTipoHotel.Items[index]; textBoxEndLogradouroHotel.Text = reader.GetString(6); textBoxEndNumeroHotel.Text = reader.GetString(7); try { textBoxEndComplementoHotel.Text = reader.GetString(8); } catch (System.Data.SqlTypes.SqlNullValueException) { textBoxEndComplementoHotel.Text = ""; } textBoxEndBairroHotel.Text = reader.GetString(9); maskedTextBoxEndCepHotel.Text = reader.GetString(10); comboBoxEndCidadeHotel.SelectedValue = reader.GetInt32(11); } } }