我需要你的帮助来完成这个方法! [英] I need your help to complete this method!
本文介绍了我需要你的帮助来完成这个方法!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string [] x = new string [] { NAME, SEX, AGE, SCHOOL};
public void ClearControls(TextBox [] A)
{
foreach(TextBox a in A)
{
a。 Text = x;
}
方法 意图 分配元素 x 一些文本框。声明:a.Text = x; 问题。我很感激它修改了 我。
谢谢。
解决方案
x是一个数组。
也许你想要的东西类似于
for ( Int32 i = 0 ; i < A.Length; i ++)
{
A [i] .Text = x [i];
}
添加正确的空值等检查。
A应该是一个获取表单中所有文本框列表的方法。
有一个增量并继续分配的计数器a.Text = x [counter];
string[] x = new string[] { "NAME", "SEX", "AGE", "SCHOOL"};
public void ClearControls(TextBox[] A)
{
foreach (TextBox a in A)
{
a.Text = x;
}
The method is intended to assign elements of x to some textboxes. The statement: a.Text=x; is the problem. I would appreciate it modified for me.
Thank you.
解决方案
x is an array.
Perhaps what you want is something similar to
for (Int32 i = 0; i < A.Length; i++) { A[i].Text = x[i]; }
Add the proper checking for nulls, etc, etc.
A should be a method that gets a list of all the textboxes in the form.
Have a counter that increments and keep assigninga.Text =x[counter];
这篇关于我需要你的帮助来完成这个方法!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文