Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp1
- {
- static class Program
- {
- static int Citire(string mesaj)
- {
- Form1 f = new Form1("un test");
- f.ShowDialog();
- return f.Valoare;
- }
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- //Form1 f = new Form1("un test");
- //// Application.Run(new Form1("un test"));
- //// Application.Run(f);//nu trebuie folosita asta pt ca distruge formularul
- //f.ShowDialog();
- //MessageBox.Show(f.Valoare.ToString());
- int n = Citire("n=");
- int[] v = new int[n];
- for(int i=0;i<v.Length;i++)
- {
- v[i] = Citire("Elem" + (i + 1));
- }
- MessageBox.Show(v.Sum().ToString());
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- public Form1(string mesaj)
- {
- InitializeComponent();
- lblMesaj.Text = mesaj;
- }
- public int Valoare
- {
- get
- {
- return int.Parse(txtValoare.Text);
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement