/// <summary> /// När positionen har ändrats i hoppet laddas AutoComplete listan om /// </summary> /// <param name="_dataGridViewList"></param> /// <param name="tabControl1"></param> /// <param name="_diveNo"></param> /// <param name="_diveNoReadOnly"></param> /// <param name="_diveName"></param> /// <param name="_diveNameReadOnly"></param> /// <param name="groupBox"></param> public static void UpdateAutoCompleteList(DataGridView currentDataGridView, TabControl tabControl1, AutoCompleteStringCollection _diveNo, AutoCompleteStringCollection _diveNoReadOnly, AutoCompleteStringCollection _diveName, AutoCompleteStringCollection _diveNameReadOnly, GroupBox groupBox) { //int columnIndex = currentDataGridView.CurrentCell.ColumnIndex; //string headerText = currentDataGridView.Columns[columnIndex].HeaderText; int rad = currentDataGridView.CurrentCell.RowIndex; string position = currentDataGridView.Rows[rad].Cells[0].Value.ToString(); string height = ""; _diveName.Clear(); _diveNo.Clear(); DiveType.DiveHeight diveHeight = DiveType.DiveHeight._1M; //hämtar den valda höjden foreach (Control button in groupBox.Controls) { RadioButton b = button as RadioButton; if (b.Checked) height = b.Text.ToString(); } switch (height) { case "1 m": diveHeight = DiveType.DiveHeight._1M; break; case "3 m": diveHeight = DiveType.DiveHeight._3M; break; case "5 m": diveHeight = DiveType.DiveHeight._5M; break; case "7,5 m": diveHeight = DiveType.DiveHeight._7_5M; break; case "10 m": diveHeight = DiveType.DiveHeight._10M; break; } DiveType diveType = new DiveType(); diveType.Height = diveHeight; SetDiveTypePosition(diveType, position); foreach (string s in _diveNoReadOnly) { diveType.No = Int32.Parse(s); if (diveType.Difficulty != 0) _diveNo.Add(s); } //diveType = new DiveType(); //diveType.Height = diveHeight; //SetDiveTypePosition(diveType, position); foreach (string s in _diveNameReadOnly) { diveType.Name = s; diveType.SetNo(); if (diveType.Difficulty != 0) _diveName.Add(s); } }