private void Agregar_notas(string cad, string Nota) { int num = 0; if (int.TryParse(Nota, out num)) { if (num < 11 && num > 3) { NotasM.Items.Add(cad); NotasN.Items.Add(Nota); float promedio = 0; foreach (string valor in NotasN.Items) { promedio += int.Parse(valor); } promedio /= NotasN.Items.Count; EtiquetaN.Text = "Con un promedio de: " + promedio; EtiquetaM.Text = "LLevas " + NotasM.Items.Count + " Materias"; } else { MessageBox.Show("Nota fuera del rango... (4-10"); } } if (NotasL.Items.Count > 0) { NotasL.SetSelected(0, true); } }
private void NotasL_SelectedValueChanged(object sender, EventArgs e) { if (NotasL.Focused) { IngresodeMateria.Text = NotasL.SelectedItem.ToString(); } if (NotasL.SelectedItems.Count == 0) { NotasL.SetSelected(0, true); } }
private void textBox1_TextChanged(object sender, EventArgs e) { int i = 0; int este = 0; if (IngresodeMateria.Focused && IngresodeMateria.Text.Length > 0) { foreach (string line in NotasL.Items) { if (line.ToUpper().Contains(IngresodeMateria.Text.ToUpper())) { este = i; } i++; } NotasL.SetSelected(este, true); } }