Questiooo.......wie geht das
-
wie kann ich aus einer TextBox den inhalt auslesen in c#
bei php ist das ja so
<form id="form1" name="form1" method="post" action="post"> <label>Name: <input name="name" type="text" id="name" /> </label> </form>
<table width="200" border="1" cellspacing="2" cellpadding="2"> <tr> <th scope="col"><?php $_POST['$name']; ?></th> </tr> </table>
-
Hallo
var string = textBox.Text;
chrische
-
ich bin anfänger.......
var string = textBox.Text;
was hat "Text" für eine funktion?'
und "var" für was ist das??
könnt mir jemand ein code schreiben der so aussieht..
am anfang ist eine TextBox in der man ein name hinein schreiben kann und rechts hat es ein button..
wenn man ein namen hineingeshrieben hat und den button gedrückt hat... kommt en neues fenster in dem der name steht....
oder unter der textBox kommt ein lable in dem der name steht..
die oberfläche
private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(25, 46); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 0; // // button1 // this.button1.Location = new System.Drawing.Point(158, 43); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 1; this.button1.Text = "name sehen"; this.button1.UseVisualStyleBackColor = true; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(275, 98); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); this.PerformLayout(); }
lg
-
Hallo
Na das wirst du dir ja wohl zusammenklicken können. In den ClickHandler des Buttons schreibst du dann einfach:
textBox2.Text = textBox1.Tetx;
was hat "Text" für eine funktion?'
Gibt des Text zurück, der in der TextBox steht. Ist keine Funktion, sondern ein Property.
und "var" für was ist das??
Allgemein gesagt, ist var ein unbestimmter Typ. Hier in dem Fall halt ein string, aber das ist abhängig davon, was man übergibt. Kann sicher jemand besser erklären.
chrische
-
Also mal ehrlich. Dies ist kein Tutorialforum.
Schaue dir bitte mal eine Einführung in c# an.
Hier kann man nicht c# lernen denn das würde fürs Forum zu weit führen.
http://openbook.galileocomputing.de/visual_csharp/
Dort findest du viele Antworten zu deinen Fragen.