public void SetTextBoxValues(string[] values)
{
if ( values.Length != TextBoxCount )
{
throw ( new ArgumentException( "There must be " + ( TextBoxCount + 1 ) +
" strings in the array" ));
}
else
{
accountTextBox.Text = values[ ( int ) TextBoxIndices.ACCOUNT ];
firstNameTextBox.Text = values[ ( int ) TextBoxIndices.FIRST ];
lastNameTextBox.Text = values[ ( int ) TextBoxIndices.LAST ];
balanceTextBox.Text = values[ ( int ) TextBoxIndices.BALANCE ];
} // end else
} // end method SetTextBoxValues
public string[] GetTextBoxValues()
{
string[] values = new string[TextBoxCount];
values[(int)TextBoxIndices.ACCOUNT] = accountTextBox.Text;
values[(int)TextBoxIndices.FIRST] = firstNameTextBox.Text;
values[(int)TextBoxIndices.LAST] = lastNameTextBox.Text;
values[(int)TextBoxIndices.BALANCE] = balanceTextBox.Text;
return values;
} // end method GetTextBoxValues
我需要知道在accountTextBox
下面出现错误的问题:
the name 'accountTextBox' does not exist in the current context
答案 0 :(得分:0)
问题:很明显,您的表单上没有名称为TextBox
的{{1}}控件。
解决方案:您可以在名称为accountTextBox
的表单上创建TextBox
控件。