hi
i wana save the radioo button which user cheched to a file i wrote this code but it dosnt work... can anyone help to found the problem:

private void button1_Click(object sender, EventArgs e)
        {
            FileStream fs = new FileStream(Path1,FileMode.Append,FileAccess.Write);
            fs.Close();
            StreamWriter Wr = new StreamWriter(Path1);
            if (radioButton1.Checked)
            {
                Wr.Write(radioButton1.Text);
                check1++;
                result1++;
            }
            if (radioButton2.Checked)
            {
                Wr.Write(radioButton2.Text);
                check1++;
            }
            if (this.radioButton2.Checked == false)
                if (radioButton1.Checked == false)
                {
                    
                    check1 = 0;
                }

Recommended Answers

All 5 Replies

StreamWriter Wr = new StreamWriter(Path1);
Wr.AutoFlush=True;
StreamWriter Wr = new StreamWriter(Path1);
Wr.AutoFlush=True;

what is the work of AutoFlush??

In lines 9 and 15 of your code, you are just writing the text of the radiobutton to a file. If your radiobutton1 text was "Mickey Mouse" and if it was checked, your file would contain the text "Mickey Mouse".

aha ok thanx alot.....:)

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.