SHARE
TWEET

Untitled

a guest Mar 21st, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6.  
  7. namespace WindowsFormsApp1
  8. {
  9.     static class Program
  10.     {
  11.        
  12.         static int Citire(string mesaj)
  13.         {
  14.             Form1 f = new Form1("un test");
  15.          
  16.             f.ShowDialog();
  17.             return f.Valoare;
  18.         }
  19.  
  20.         [STAThread]
  21.         static void Main()
  22.         {
  23.             Application.EnableVisualStyles();
  24.             Application.SetCompatibleTextRenderingDefault(false);
  25.  
  26.             //Form1 f = new Form1("un test");
  27.             //// Application.Run(new Form1("un test"));
  28.  
  29.             //// Application.Run(f);//nu trebuie folosita asta pt ca distruge formularul
  30.  
  31.             //f.ShowDialog();
  32.             //MessageBox.Show(f.Valoare.ToString());
  33.  
  34.             int n = Citire("n=");
  35.             int[] v = new int[n];
  36.  
  37.             for(int i=0;i<v.Length;i++)
  38.             {
  39.                 v[i] = Citire("Elem" + (i + 1));
  40.  
  41.             }
  42.  
  43.             MessageBox.Show(v.Sum().ToString());
  44.         }
  45.     }
  46. }
  47.  
  48.  
  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.Threading.Tasks;
  57. using System.Windows.Forms;
  58.  
  59. namespace WindowsFormsApp1
  60. {
  61.     public partial class Form1 : Form
  62.     {
  63.         public Form1(string mesaj)
  64.         {
  65.             InitializeComponent();
  66.             lblMesaj.Text = mesaj;
  67.         }
  68.  
  69.         public int Valoare
  70.         {
  71.             get
  72.             {
  73.                 return int.Parse(txtValoare.Text);
  74.             }
  75.         }
  76.  
  77.  
  78.         private void button1_Click(object sender, EventArgs e)
  79.         {
  80.             Close();
  81.         }
  82.     }
  83. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top