Results 1 to 5 of 5

Thread: Buttons.visible?

  1. #1

    Thread Starter
    Lively Member flog3941's Avatar
    Join Date
    Nov 2002
    Posts
    123

    Buttons.visible?

    Im using a streamreader and a streamwriter, what im trying to do is record wether a button is visible at the time the stream writer writes. I have a form that the buttons are visible sometimes then after certan actions they are not and I need to keep track of that.

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    well why dont you just check for the Visible property of your button?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    Lively Member flog3941's Avatar
    Join Date
    Nov 2002
    Posts
    123
    This is what i have, the only thing is the its not recorcing the .visible part!



    Dim st1 As New System.IO.StreamReader(New System.IO.FileStream("c:\Documents and Settings\Owner\My Documents\" & fname, IO.FileMode.OpenOrCreate))
    form2.TextBox32.Text = st1.ReadLine
    form2.signinfri.Visible = st1.Read
    form2.signoutfri.Visible = st1.Read


    Dim sw1 As New System.IO.StreamWriter(New System.IO.FileStream("c:\Documents and Settings\Owner\My Documents\" & fname, IO.FileMode.Truncate))
    sw1.WriteLine(TextBox32.Text)
    sw1.Write(signinfri.Visible)
    sw1.Write(signoutfri.Visible)

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    If I was you, I would take advantage of the BinaryReader/Writer classes. These classes can read and write data from a stream directly into typed variables.

    Code:
    private void button1_Click(object sender, System.EventArgs e)
    {
    	FileStream outStream = File.Create(@"c:\settings.dat");
    	BinaryWriter bwSettings = new BinaryWriter(outStream);
    
    	// save button visibility state
    	bwSettings.Write((bool)this.button1.Visible);
    	bwSettings.Flush();
    	bwSettings.Close();
    	FileStream inStream = File.OpenRead(@"c:\settings.dat");
    	BinaryReader brSettings = new BinaryReader(inStream);
                 bool visiblity = brSettings.ReadBoolean();
    	MessageBox.Show(visiblity.ToString());
    }

  5. #5
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    just try .visible.tostring instead of .visible
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width