Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////FORM 1 SA KLASOM TAKMICAR///////////////////////////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Form2 f2 = new Form2();
- if(f2.ShowDialog()==DialogResult.OK)textBox1.Text + Form2.t1.ToString());
- }
- }
- public class Takmicar
- {
- private string ime;
- private string prezime;
- private int pismeni;
- private int usmeni;
- public Takmicar(string i, string p, int pi, int u)
- {
- ime = i;
- prezime = p;
- pismeni = pi;
- usmeni = u;
- }
- public override string ToString()
- {
- return ime + " " + prezime + " " + (pismeni + usmeni);
- }
- }
- }
- //////////////////////////////////////////////////FORM 2///////////////////////////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form2 : Form
- {
- public Form2()
- {
- InitializeComponent();
- }
- public static Takmicar t1;
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- textBox3.Enabled = true;
- textBox4.Enabled = true;
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- textBox2.Enabled = true;
- }
- int u;
- int p;
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox1.Checked)
- {
- try
- {
- u = Convert.ToInt32(textBox3.Text);
- p = Convert.ToInt32(textBox4.Text);
- button1.Enabled = true;
- }
- catch (Exception f)
- {
- MessageBox.Show(f.Message + "Greska", "Greska", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- t1 = new Takmicar(textBox1.Text, textBox2.Text, u, p);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment