Goran Bibic

Goran Bibic

  • 455
  • 2.9k
  • 197.9k

Selection changed dont work

Mar 16 2018 3:42 AM
Selection changed not work when put inside cod && vrijemeodjaveDateTimePicker == null
 
Complete code down
 without  && vrijemeodjaveDateTimePicker == null  working fine
  1. private void prijava_radnikaDataGridView_SelectionChanged(object sender, EventArgs e)  
  2.         {  
  3.             if (prijava_radnikaDataGridView.SelectedRows.Count > 0 && vrijemeodjaveDateTimePicker == null) // make sure user select at least 1 row   
  4.             {  
  5.   
  6.                 string id = prijava_radnikaDataGridView.CurrentRow.Cells["dataGridViewTextBoxColumn1"].FormattedValue.ToString();  
  7.                string radnik = prijava_radnikaDataGridView.CurrentRow.Cells["dataGridViewTextBoxColumn9"].FormattedValue.ToString();  
  8.                 string redni_broj = prijava_radnikaDataGridView.CurrentRow.Cells["redni_broj"].FormattedValue.ToString();  
  9.                   
  10.                   
  11.   
  12.                 radnikComboBox.Text = radnik;  
  13.                 vrijemeprijaveDateTimePicker.Value = Convert.ToDateTime(prijava_radnikaDataGridView.SelectedRows[0].Cells["dataGridViewTextBoxColumn2"].Value);  
  14.                vrijemeodjaveDateTimePicker.Value = Convert.ToDateTime(prijava_radnikaDataGridView.SelectedRows[0].Cells["dataGridViewTextBoxColumn3"].Value);  
  15.                 redni_brojTextBox.Text = redni_broj;  
  16.                 idPrijavaTextBox.Text = id;  
  17.                   
  18.             }  
  19.         } 
 

Answers (1)