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.
Asked
Active
Viewed 3,175 times
2

Kurubaran
- 8,696
- 5
- 43
- 65

Aparna Savant
- 337
- 1
- 6
- 18
-
What do you mean by saving checkbox values to file ? you want to simply save selected values to a textfile ? – Kurubaran Oct 19 '13 at 18:13
-
Yes, I simply want to save selected values to text file. – Aparna Savant Oct 21 '13 at 16:20
1 Answers
4
You can easily do it with installer class.
- First of add installer class to your setup project. Go to
Add
>Add New Item
>Select Installer class
Create a Window Form with radio button to get user input and logic to save selected values to a text file.
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.
-
But I am not able to add InstallerClass to my setup project with the process you told me. I tried to google it but I don't have any option such "Add new item" which will add classes. Do I need to change any setting? – Aparna Savant Oct 21 '13 at 18:56
-
@AparnaSavant Just right click on the project and go to add item, its like how you add a class to a project. – Kurubaran Oct 21 '13 at 20:23
-
Sorry, but after clicking right button on Project, I am able to see following options under "Add": "Project Output", "File", "Merge Module", "Assembly". There is no "Add Item" option which will eventually lead me to "Installer CLass". Please guide me what wrong I am doing. – Aparna Savant Oct 21 '13 at 22:42
-
Add a new C# class library project, Right click on it and select Add > New Item > Select Visual C# items > Installer Class. – Kurubaran Oct 22 '13 at 08:09
-
+1 to AccessDenied. He's done a lot of work to help you out, Aparna. Upvoting his work or marking it as an answer is his only reward for helping. – Oct 22 '13 at 13:13
-
@AccessDenied I did as per your instructions. I am able to compile my project successfully. But while installing my application I am having an error as "Error 1001: FileLoadException error..." In debug log I am able to see an error as "Error 2835: The control ErrorIcon was not found on dialog ErrorDialog" Also I am having " Error 2826: Control Control372 on dialog CustomCheckD extends beyond the boundaries of the dialog to the right by 3 pixels" error for many dialogs. CAn you please help me on this? – Aparna Savant Oct 30 '13 at 17:49
-
@AparnaSavant Are you using windows installer ? or InstallShield ? Are you using any custom control ? – Kurubaran Oct 30 '13 at 17:57
-
-
I have created a an extra checkbox by editing .wid file using Orca. – Aparna Savant Oct 30 '13 at 18:07