0

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

 public System.Windows.Forms.TextBox passwordBox;

为该字段所做的其他设置是

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();

我无法阅读在 TextBox 中输入的文本

我正在使用以下行读取值

string text = PasswordBox.Text;

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

4

1 回答 1

1

text = passwordBox.Text;的,只有这样你才能得到它!

于 2012-05-05T07:17:36.093 回答