Srxon05

Takmicari

Feb 24th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.74 KB | None | 0 0
  1. //////////////////////////////////////////////////FORM 1 SA KLASOM TAKMICAR///////////////////////////////////////////////////////////
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void button1_Click(object sender, EventArgs e)
  21.         {
  22.             Form2 f2 = new Form2();
  23.             if(f2.ShowDialog()==DialogResult.OK)textBox1.Text + Form2.t1.ToString());
  24.         }
  25.  
  26.        
  27.     }
  28.     public class Takmicar
  29.     {
  30.         private string ime;
  31.         private string prezime;
  32.         private int pismeni;
  33.         private int usmeni;
  34.  
  35.         public Takmicar(string i, string p, int pi, int u)
  36.         {
  37.             ime = i;
  38.             prezime = p;
  39.             pismeni = pi;
  40.             usmeni = u;
  41.         }
  42.         public override string ToString()
  43.         {
  44.             return ime + " " + prezime + " " + (pismeni + usmeni);
  45.         }
  46.     }
  47. }
  48. //////////////////////////////////////////////////FORM 2///////////////////////////////////////////////////////////
  49. using System;
  50. using System.Collections.Generic;
  51. using System.ComponentModel;
  52. using System.Data;
  53. using System.Drawing;
  54. using System.Linq;
  55. using System.Text;
  56. using System.Windows.Forms;
  57.  
  58. namespace WindowsFormsApplication1
  59. {
  60.     public partial class Form2 : Form
  61.     {
  62.         public Form2()
  63.         {
  64.             InitializeComponent();
  65.         }
  66.         public static Takmicar t1;
  67.         private void textBox2_TextChanged(object sender, EventArgs e)
  68.         {
  69.             textBox3.Enabled = true;
  70.             textBox4.Enabled = true;
  71.         }
  72.  
  73.         private void textBox1_TextChanged(object sender, EventArgs e)
  74.         {
  75.             textBox2.Enabled = true;
  76.         }
  77.         int u;
  78.         int p;
  79.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  80.         {
  81.            
  82.             if (checkBox1.Checked)
  83.             {
  84.                 try
  85.                 {
  86.                     u = Convert.ToInt32(textBox3.Text);
  87.                     p = Convert.ToInt32(textBox4.Text);
  88.                     button1.Enabled = true;
  89.  
  90.                 }
  91.                 catch (Exception f)
  92.                 {
  93.                     MessageBox.Show(f.Message + "Greska", "Greska", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
  94.                 }
  95.             }
  96.         }
  97.  
  98.         private void button1_Click(object sender, EventArgs e)
  99.         {
  100.             t1 = new Takmicar(textBox1.Text, textBox2.Text, u, p);
  101.         }
  102.     }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment