清除申请表中的所有字段,重置为下一位客户。 [英] Clearing all fields in an application form,reset for next customer.

查看:73
本文介绍了清除申请表中的所有字段,重置为下一位客户。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我按下重置按钮时,我可以清除所有文本框,即txtName.text =..我可以用同样的方式清除组合框,但是如何重置radiobuttons,checkboxes和listbox内容已被选中。

解决方案

它的C#代码,我昨天解决了类似的问题:

  private   void  button1_Click_1( object  sender, EventArgs e)
{
List< TextBox> t = new 列表< TextBox>();

t.Add(textBox1);
t.Add(textBox2);
t.Add(textBox3);
t.Add(textBox4);

foreach (TextBox txt in t)
{
txt.Clear();
}

comboBox1.SelectedIndex = 0 ;
checkBox1.Checked = false ;
radioButton1.Checked = false ;
}
}


C#到VB的
,请点击此链接: http://converter.telerik.com/ [ ^ ]


感谢那个家伙,但我几乎没有掌握VB.net,是一个完整的新手和所有这些。

我需要一个Vb代码的答案,转换器不工作,它一直告诉我有一个错误。

非常感谢:)


hi,

喜欢这个:



 私有  Sub  ResetTxtBox()
对于 每个 x As TextBox Me .Controls
x .Text = 字符串 .Empty
下一步
结束 Sub


I can clear all the text boxes when i press reset button ,ie, txtName.text = "".. i can clear the combo boxes in the same way,but how do i reset the radiobuttons,checkboxes and listbox contents that have been selected.

解决方案

Its C# code, I''ve solved yesterday similar kinda question :

private void button1_Click_1(object sender, EventArgs e)
       {
           List<TextBox> t = new List<TextBox>();

           t.Add(textBox1);
           t.Add(textBox2);
           t.Add(textBox3);
           t.Add(textBox4);

           foreach (TextBox txt in t)
           {
               txt.Clear();
           }

           comboBox1.SelectedIndex = 0;
           checkBox1.Checked = false;
           radioButton1.Checked = false;
       }
   }


for C# to VB, follow this link : http://converter.telerik.com/[^]


Thanks for that dude ,but i barely have a grasp of VB.net,being a complete novice and all that.
I need an answer with Vb code,the converter doesn''t work,it keeps telling me there is an error.
Much thanks anyway :)


hi,
like this:

Private Sub ResetTxtBox()
    For Each x As TextBox In Me.Controls
        x.Text = String.Empty
    Next
End Sub


这篇关于清除申请表中的所有字段,重置为下一位客户。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆