Cannot implicitly convert type 'string' to 'System.Windows.Forms.TextBox'

I do not know what to do because the error is in Form1.Designer.csand because I have no experience in debugging this part of the program.

//Form1
// 
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(352, 246);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Generate Username";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
+4
source share
2 answers

Error on this .Name = "Form1";

I suspect that you created a control with a name Namethat conflicts with the Namewindow property . Just rename the control to another and it should work again.

+15
source

- , TextBox. , TextBox Text TextBox.

:

TextBox tb = new TextBox();
tb = "Default text";

:

TextBox tb = new TextBox();
tb.Text = "Default text";

Name Text, NameTextBox - .

+5

Source: https://habr.com/ru/post/1524296/


All Articles