C# 从文本框读取密码

C# 从文本框读取密码,c#,winforms,C#,Winforms,我在C#as中创建了一个密码字段 此字段的其他设置包括 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.CornflowerBlue; this.Cli

我在C#as中创建了一个密码字段

此字段的其他设置包括

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.CornflowerBlue;
            this.ClientSize = new System.Drawing.Size(381, 199);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.label1);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Progpassword";
            this.Text = "Programmer Password";
            this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
            this.Load += new System.EventHandler(this.Progpassword_Load);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

我无法阅读文本框中输入的文本

我正在使用以下行读取值

string text = PasswordBox.Text;

这是读取密码字段的正确方法。

text=passwordBox.text是唯一可以得到它的方法

您想如何读取该文本框?@Likurg我正在使用密码将值放入字符串字段。text“我无法读取在密码框中输入的文本”这是什么意思???可能您的错误是使用密码框。text-第一个字母不能是大写。。。只有passwordBox.text当您试图读取该密码时?@Likurg,但它无法将在密码字段中输入的值分配给文本变量
string text = PasswordBox.Text;