Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
228 views
in Technique[技术] by (71.8m points)

c# - How to handle checkbox controls in windows installer?

I am using Visual Studio 2008 to create a setup project. I want to create a file which will contain values of the checkboxes which are selected by user during installation. How and where to write the code for the same? I am new to windows installer. Please provide me pointers for the same. Thank you in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can easily do it with installer class.

  1. First of add installer class to your setup project. Go to Add > Add New Item > Select Installer class

Installer Class

  1. Create a Window Form with radio button to get user input and logic to save selected values to a text file.

  2. Within installer class`s Install method open windows form to get the user input. So during the installation windows form will pop up where user can select the values.(Please not that this form will not open as a modal pop up)

Install()

 public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);

            Form1 form = new Form1();
            form.ShowDialog();
        }

Best approach

Best approach to get the user input during the installation is to create .wid file. See my post here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...