Guest User

forma1

a guest
Jun 21st, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  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. using System.Timers;
  11. using System.Threading;
  12. using System.Data.SqlClient;
  13. namespace projekt
  14. {
  15. public partial class Programowanie : Form
  16. {
  17.  
  18. public int godziny, minuty, sekundy = 0;
  19. public string polaczenie_baza="Data Source=MATEUSZ111\\SQLEXPRESS;Initial Catalog=project;Integrated Security=True";
  20. private koniec_programowanie frm;
  21. public int przechwytywanie ;
  22.  
  23. public Programowanie()
  24. {
  25. InitializeComponent();
  26. }
  27.  
  28. private void timer1_Tick(object sender, EventArgs e)
  29. {
  30.  
  31. label1.Text = godziny+":"+minuty+":"+sekundy.ToString();
  32. sekundy++;
  33.  
  34. if(sekundy>=60)
  35. {
  36. minuty++;
  37. sekundy = 0;
  38. }
  39. if (minuty >= 60)
  40. {
  41. godziny++;
  42. minuty = 0;
  43. }
  44. }
  45.  
  46. private void label1_Click(object sender, EventArgs e)
  47. {
  48.  
  49. }
  50.  
  51. private void button1_Click(object sender, EventArgs e)
  52. {
  53.  
  54. timer1.Start();
  55. }
  56.  
  57. private void button3_Click(object sender, EventArgs e)
  58. {
  59. frm = new koniec_programowanie();
  60. frm.Show();
  61.  
  62.  
  63. }
  64.  
  65. private void button4_Click(object sender, EventArgs e)
  66. {
  67. przechwytywanie = new int();
  68. przechwytywanie = sekundy;
  69. MessageBox.Show(przechwytywanie.ToString());
  70.  
  71. }
  72.  
  73. private void Programowanie_Load(object sender, EventArgs e)
  74. {
  75. {
  76. SqlConnection con = new SqlConnection(polaczenie_baza);
  77. con.Open();
  78. string zapytanie = "select * from historia_nauki";
  79. SqlCommand kom1 = new SqlCommand(zapytanie, con);
  80. SqlDataAdapter sqlDataAdap = new SqlDataAdapter(kom1);
  81.  
  82. DataTable dtRecord = new DataTable();
  83. sqlDataAdap.Fill(dtRecord);
  84. dataGridView1.DataSource = dtRecord;
  85. }
  86. {
  87. this.dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
  88. this.dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
  89. this.dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
  90. this.dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
  91. this.dataGridView1.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
  92. }
  93.  
  94.  
  95.  
  96.  
  97.  
  98. }
  99.  
  100. private void button2_Click(object sender, EventArgs e)
  101. {
  102. timer1.Stop();
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment