private void Megnyitas() { if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { string tartalom = File.ReadAllText(openFileDialog1.FileName); string[] reszek = tartalom.Split(';'); string nev = reszek[0]; NameBox.Text = nev; string ev = reszek[1]; AgeBox2.Text = ev; if (reszek[2] == "Nő") { FemaleRadioButton.PerformClick(); } else if (reszek[2] == "férfi") { MaleRadioButton.PerformClick(); } string lista = reszek[3]; string[] kedvenc = reszek[4].Split(','); for (int i = 0; i < kedvenc.Length; i++) { FavListBox.Items.Add(kedvenc[i]); } FavListBox.SelectedItem = lista; } }
private void StaffListView_MouseClick(object sender, MouseEventArgs e) { StaffIDTextbox.Text = StaffListView.SelectedItems[0].SubItems[0].Text; StaffNameTextBox.Text = StaffListView.SelectedItems[0].SubItems[1].Text; StaffPhoneNumberTextBox.Text = StaffListView.SelectedItems[0].SubItems[2].Text; StaffAddressTextBox.Text = StaffListView.SelectedItems[0].SubItems[3].Text; StaffAgeTextBox.Text = StaffListView.SelectedItems[0].SubItems[4].Text; if (StaffListView.SelectedItems[0].SubItems[5].Text == "Male") { MaleRadioButton.PerformClick(); } else { FemaleRadioButton.PerformClick(); } SIN = StaffListView.Items.IndexOf(StaffListView.SelectedItems[0]); }
public void PatientListView_MouseClick(object sender, MouseEventArgs e) { clrscreen(); PatientIDTextbox.Text = PatientListView.SelectedItems[0].SubItems[0].Text; PatientNameTextBox.Text = PatientListView.SelectedItems[0].SubItems[1].Text; PatientRoomTextBox.Text = PatientListView.SelectedItems[0].SubItems[2].Text; PatientPhoneNumberTextBox.Text = PatientListView.SelectedItems[0].SubItems[3].Text; PatientAddressTextBox.Text = PatientListView.SelectedItems[0].SubItems[4].Text; PatientAgeTextBox.Text = PatientListView.SelectedItems[0].SubItems[5].Text; if (PatientListView.SelectedItems[0].SubItems[6].Text == "Male") { MaleRadioButton.PerformClick(); } else { FemaleRadioButton.PerformClick(); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { SqlConnection con = new SqlConnection("Data Source=DESKTOP-P024OII\\TARIQULPC;Initial Catalog=Library_Management_System;Integrated Security=True"); string gender = ""; try { DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex]; StuIDTextBox.Text = row.Cells[0].FormattedValue.ToString(); StuNameTextBox.Text = row.Cells[1].FormattedValue.ToString(); StuAgeTextBox.Text = row.Cells[2].FormattedValue.ToString(); gender = row.Cells[3].FormattedValue.ToString(); StuSemTextBox.Text = row.Cells[4].FormattedValue.ToString(); StuContactTextBox.Text = row.Cells[5].FormattedValue.ToString(); StuEmailTextBox.Text = row.Cells[6].FormattedValue.ToString(); DeptComboBox.Text = row.Cells[7].FormattedValue.ToString(); if (gender == "Male") { MaleRadioButton.Focus(); } if (gender == "Female") { FemaleRadioButton.Focus(); } con.Open(); SqlCommand cmd = new SqlCommand("select * from Student_table where StuID = '" + StuIDTextBox.Text + "'; ", con); SqlDataReader Reader = cmd.ExecuteReader(); Reader.Read(); PasswordTextBox.Text = Reader[9].ToString(); if (Reader.HasRows) { byte[] image = (byte[])Reader[8]; if (image == null) { StuPictureBox.Image = null; } else { MemoryStream MS = new MemoryStream(image); StuPictureBox.Image = Image.FromStream(MS); } } else { MessageBox.Show("Not available...."); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } }