小白程序員在這裏很抱歉,如果我失去了一些東西很簡單的使用,這裏是我的代碼:非可調用成員「System.Windows.Forms.Control.Text」不能等的方法
namespace Programming_Assignment_2
{
public partial class Form1 : Form
{
string combination;
const int MinLength = 6;
bool CombinationCheck(string combination)
{
if (combination.Length > 5)
return true;
else
return false;
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btn_SetComb_Click(object sender, EventArgs e)
{
combination = My_Dialogs.InputBox("Please enter a password longer than 5 characters: ");
if (combination.Length < MinLength)
My_Dialogs.InputBox("Error! Please make sure password is longer than 5 characters: ");
else
{
MessageBox.Show("Thank you, password saved.");
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void text_SafeStatus_TextChanged(object sender, EventArgs e)
{
bool CombinationCheck;
if (
text_SafeStatus.Text("Combination Set"));
else (
text_SafeStatus.Text("Combination Not Set"));
}
}
}
所以底部的文本返回標題中的錯誤,我在這裏和那裏還有幾個小錯誤,例如
只有賦值,調用,增量,遞減,等待和新對象表達式可以用作聲明
之後的其他支架..
什麼可能是一個noob問題,但我似乎無法找到答案,即專門幫我
編輯1再次抱歉:
所以文本錯誤是固定的,我感謝,但我有一個問題這是試圖從一個布爾真/假值,並用它來確定哪些文本框中顯示..
if bool CombinationCheck;
if CombinationCheck true;
text_SafeStatus.Text = "Combination Set";
else
text_SafeStatus.Text = "Combination Not Set";
這就是我現在有,我不知道如何使這項工作。
如果(combinationCheck){text_SafeStatus.Text = 「組合套裝」}其他{...} –
@JeroenHeier怎麼樣'CombinationCheck? text_SafeStatus.Text =「組合集」:text_SafeStatus.Text =「組合未設置」;' – devRicher
@CameronFairbun,你應該接受解決你的_original_問題的答案併發布_new_問題的新問題 – user3598756