本文介绍了将选项卡重置为设计默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我设计的TabPage具有使用特定值和可见性创建的文本和框,则在处理过程中某些值会发生更改,而某些框会被隐藏和隐藏,是否可以有一个按钮来重置所有这些更改并重新显示按原始设计的TabPage,还是我必须在按钮的代码内进行硬编码,而不要进行所有更改?我希望这是有道理的!

If I design a TabPage with texts and boxes created with specific values & visibility, then during processing some values get altered and some boxes get hidden & unhidden, is it possible to have a button that resets all these changes and re-displays the TabPage as per the original design, or do I have to hard code within the button''s code the opposite of all the changes I''ve made ? I hope that makes sense !!!

推荐答案


public KALCForm1()
{
    InitializeComponent();

    //Ensure comboBox is empty
    KALCcomboBox1.Items.Clear();

    //Fill comboBox with an entry for each League in the Database
    SqlConnection cs = new SqlConnection(@"Data Source=MEDESKTOP;AttachDbFilename=J:\Users\Gary\Documents\Visual Studio 2010\Projects\KALeagueCup\KALeagueCup\KADatabase.mdf;Initial Catalog=myKADB;Integrated Security=True");
    SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM LEAGUES", cs);

    DataTable dt = new DataTable();

    da.Fill(dt);

    for (int i = 0; i < dt.Rows.Count; i++)
    {
        KALCcomboBox1.Items.Add(dt.Rows[i]["LeagueName"]);
    }
}



如果我想重新显示原始表单,那么是否可以将此代码保存在其他位置并从此处或从其他任何位置调用",或者我是否又想像成Mainframe程序员?!?!?



Could this code be kept elsewhere and "Called" from here and from anywhere else if I wanted to re-display the original form, or am I thinking too much like a Mainframe programmer again ?!?!?


这篇关于将选项卡重置为设计默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 06:16