Member Avatar for alex-i

Hi everyone

I need a help about checkbox. when I select 3 or 4 checkbox from 6 checkbox who I have in my form, and I click Submit button all name of checkbox selected to save on text document on drive c or any other location.

thank you for help

Please show us your code work and also tell us about your application type - windows/web?

Member Avatar for alex-i

ok man I am begginer in C#

In this project i use csharp windows application.

My form contain some checkbox and one button for submit.
when i select some checkbox and click button submit, all text of checkbox selected needs to save in any text file.

example: after submit text file contain:

checkbox1
checkbox2
checkbox5
checkbox6

Thanks for help!

StringBuilder sb = new StringBuilder();
            if(checkBox1.Checked)
             sb.AppendLine(checkBox1.Text);
            if(checkBox2.Checked)
             sb.AppendLine(checkBox2.Text);

            System.IO.File.WriteAllText(@"c:\p1.txt",sb.ToString());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.