Ik wil textboxen van form1 gebruiken in program.cs, hoe moet dit? Ik heb geprobeerd private te veranderen in public static maar dan krijg ik deze error (25 keer):
"Error 1 Member 'Car_Adder.Form1.textBox4' cannot be accessed with an instance reference; qualify it with a type name instead"
Weet iemand hoe ik het anders moet doen?
Mijn Form1.Designer.cs:
"Error 1 Member 'Car_Adder.Form1.textBox4' cannot be accessed with an instance reference; qualify it with a type name instead"
Weet iemand hoe ik het anders moet doen?
Mijn Form1.Designer.cs:
Code:
namespace Car_Adder
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.AccessibleName = "MainBox";
this.groupBox1.Controls.Add(this.button5);
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.textBox4);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(564, 319);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Add Cars";
//
// button5
//
this.button5.AccessibleName = "Klaar";
this.button5.Location = new System.Drawing.Point(237, 284);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 13;
this.button5.Text = "Klaar";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button4
//
this.button4.AccessibleName = "DefVehicles";
this.button4.Location = new System.Drawing.Point(453, 242);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 12;
this.button4.Text = "Standaard";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(29, 242);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(396, 20);
this.textBox4.TabIndex = 11;
//
// label5
//
this.label5.AccessibleName = "Vraag4";
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(26, 216);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(133, 13);
this.label5.TabIndex = 10;
this.label5.Text = "Voer de Vehicles.ide lijn in:";
//
// button3
//
this.button3.AccessibleName = "DefHandling";
this.button3.Location = new System.Drawing.Point(453, 118);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 9;
this.button3.Text = "Standaard";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.AccessibleName = "DefCarcols";
this.button2.Location = new System.Drawing.Point(453, 177);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 8;
this.button2.Text = "Standaard";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(29, 180);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(396, 20);
this.textBox3.TabIndex = 7;
//
// label4
//
this.label4.AccessibleName = "Vraag3";
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(26, 155);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(129, 13);
this.label4.TabIndex = 6;
this.label4.Text = "Voer de Carcols.dat lijn in:";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(29, 118);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(396, 20);
this.textBox2.TabIndex = 5;
//
// label3
//
this.label3.AccessibleName = "Vraag2";
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(26, 93);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(136, 13);
this.label3.TabIndex = 4;
this.label3.Text = "Voer de Handling.dat lijn in:";
//
// button1
//
this.button1.AccessibleName = "ThisPath";
this.button1.Location = new System.Drawing.Point(453, 52);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 3;
this.button1.Text = "Deze locatie";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.AccessibleName = "Path";
this.textBox1.Location = new System.Drawing.Point(29, 55);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(396, 20);
this.textBox1.TabIndex = 2;
//
// label2
//
this.label2.AccessibleName = "Vraag1";
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(26, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(135, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Voer de bestandslocatie in:";
//
// label1
//
this.label1.AccessibleName = "Badboy";
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(463, 294);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(93, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Made by Bad.boy!";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(599, 343);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "IV Car Adder";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
public static System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label4;
public static System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
public static System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button4;
public static System.Windows.Forms.TextBox textBox4;
}
}
Laatst bewerkt: