<div dir="ltr"><div><div><div><div>ciao a tutti,<br>mi sto cimentando con sharpdevelop, nello sviluppare una interfaccia grafica stupida: 2 textbox che prendono due numeri ("a" e "b") e quando faccio click su un pulsante, faccio la somma e la visualizzo su un terzo textbox  ("c") . <br>
<br></div>Il codice è il seguente:<br><br>import System.Drawing
<br>import System.Windows.Forms
<br> <br>from System.Drawing import *
<br>from System.Windows.Forms import *
<br> <br>class MainForm(Form):
<br>    def __init__(self):
<br>        self.InitializeComponent()
<br>     <br>    def InitializeComponent(self):
<br>        self._button1 = System.Windows.Forms.Button()
<br>        self._a = System.Windows.Forms.TextBox()
<br>        self._label1 = System.Windows.Forms.Label()
<br>        self._label2 = System.Windows.Forms.Label()
<br>        self._b = System.Windows.Forms.TextBox()
<br>        self._label3 = System.Windows.Forms.Label()
<br>        self._c = System.Windows.Forms.TextBox()
<br>        self._label4 = System.Windows.Forms.Label()
<br>        self._label5 = System.Windows.Forms.Label()
<br>        self.SuspendLayout()
<br>        # 
<br>        # button1
<br>        # 
<br>        self._button1.Location = System.Drawing.Point(349, 113)
<br>        self._button1.Name = "button1"
<br>        self._button1.Size = System.Drawing.Size(75, 23)
<br>        self._button1.TabIndex = 0
<br>        self._button1.Text = "Somma"
<br>        self._button1.UseVisualStyleBackColor = True
<br>        self._button1.Click += self.Button1Click
<br>        # 
<br>        # a
<br>        # 
<br>        self._a.Location = System.Drawing.Point(219, 35)
<br>        self._a.Name = "a"
<br>        self._a.Size = System.Drawing.Size(100, 20)
<br>        self._a.TabIndex = 1
<br>        # 
<br>        # label1
<br>        # 
<br>        self._label1.Location = System.Drawing.Point(163, 35)
<br>        self._label1.Name = "label1"
<br>        self._label1.Size = System.Drawing.Size(31, 23)
<br>        self._label1.TabIndex = 2
<br>        self._label1.Text = "a"
<br>        self._label1.Click += self.Label1Click
<br>        # 
<br>        # label2
<br>        # 
<br>        self._label2.Location = System.Drawing.Point(163, 74)
<br>        self._label2.Name = "label2"
<br>        self._label2.Size = System.Drawing.Size(31, 23)
<br>        self._label2.TabIndex = 4
<br>        self._label2.Text = "b"
<br>        self._label2.Click += self.Label2Click
<br>        # 
<br>        # b
<br>        # 
<br>        self._b.Location = System.Drawing.Point(219, 74)
<br>        self._b.Name = "b"
<br>        self._b.Size = System.Drawing.Size(100, 20)
<br>        self._b.TabIndex = 3
<br>        # 
<br>        # label3
<br>        # 
<br>        self._label3.Location = System.Drawing.Point(163, 113)
<br>        self._label3.Name = "label3"
<br>        self._label3.Size = System.Drawing.Size(31, 23)
<br>        self._label3.TabIndex = 6
<br>        self._label3.Text = "Tot"
<br>        # 
<br>        # c
<br>        # 
<br>        self._c.Location = System.Drawing.Point(219, 113)
<br>        self._c.Name = "c"
<br>        self._c.Size = System.Drawing.Size(100, 20)
<br>        self._c.TabIndex = 5
<br>        # 
<br>        # label4
<br>        # 
<br>        self._label4.Location = System.Drawing.Point(349, 38)
<br>        self._label4.Name = "label4"
<br>        self._label4.Size = System.Drawing.Size(31, 23)
<br>        self._label4.TabIndex = 7
<br>        self._label4.Text = "+"
<br>        # 
<br>        # label5
<br>        # 
<br>        self._label5.Location = System.Drawing.Point(349, 71)
<br>        self._label5.Name = "label5"
<br>        self._label5.Size = System.Drawing.Size(31, 23)
<br>        self._label5.TabIndex = 8
<br>        self._label5.Text = "="
<br>        # 
<br>        # MainForm
<br>        # 
<br>        self.ClientSize = System.Drawing.Size(781, 258)
<br>        self.Controls.Add(self._label5)
<br>        self.Controls.Add(self._label4)
<br>        self.Controls.Add(self._label3)
<br>        self.Controls.Add(self._c)
<br>        self.Controls.Add(self._label2)
<br>        self.Controls.Add(self._b)
<br>        self.Controls.Add(self._label1)
<br>        self.Controls.Add(self._a)
<br>        self.Controls.Add(self._button1)
<br>        self.Name = "MainForm"
<br>        self.Text = "prova"
<br>        self.Load += self.MainFormLoad
<br>        self.ResumeLayout(False)
<br>        self.PerformLayout()
<br> <br> <br>    def MainFormLoad(self, sender, e):
<br>        pass
<br> <br>    def Button1Click(self, sender, e):
<br>        pass
<br> <br>    def Label1Click(self, sender, e):
<br>        pass
<br> <br>    def Label2Click(self, sender, e):
<br>        pass
<br>     <br>    <br><br><br></div>L'interfaccia grafica è quindi disegnata.<br>Come faccio a fare l'operazione ?<br></div>Ossia come punto ai valori di "a" e "b" e scrivo il risultato in "c", quando clicco sul pulsante ?<br>
</div><br></div>