Form2.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace WindowsFormsApp3
  11. {
  12. public partial class Form2 : Form
  13. {
  14. public Form2()
  15. {
  16. InitializeComponent();
  17. }
  18. private void Form2_Load(object sender, EventArgs e)
  19. {
  20. // TODO: данная строка кода позволяет загрузить данные в таблицу "_12gkDataSet.Prodykt". При необходимости она может быть перемещена или удалена.
  21. this.prodyktTableAdapter.Fill(this._12gkDataSet.Prodykt);
  22. }
  23. private void textBox1_TextChanged(object sender, EventArgs e)
  24. {
  25. for (int i = 0; i < dataGridView1.RowCount; i++)
  26. for (int j = 0; j < dataGridView1.ColumnCount; j++)
  27. {
  28. if (dataGridView1.Rows[i].Cells[j].Value == null)
  29. {
  30. break;
  31. }
  32. if (textBox1.Text == dataGridView1.Rows[i].Cells[j].Value.ToString())
  33. {
  34. dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[j];
  35. dataGridView1.FirstDisplayedScrollingRowIndex = i;
  36. break;
  37. }
  38. }
  39. }
  40. private void button1_Click(object sender, EventArgs e)
  41. {
  42. var Form2 = new Form1();
  43. Form2.Show();
  44. }
  45. }
  46. }