c# question

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
Jdogg





Posts: 184
Joined: Thu Aug 31, 2006 3:18 pm

c# question

Post by Jdogg »

Hello, i am fairly new at c#.

i am trying to get all the controls on a form, then write a text file that has that controls X, Y, Width, Height, And Text in that order.

this is what i have:

Code: Select all

                foreach (Button btn in this.Controls)
                {
                    string dir_ = Console.ReadLine() + "\\config";
                    System.IO.Directory.CreateDirectory(dir_);
                    System.IO.File.WriteAllText(dir_ + "\\" + btn.Name + ".btn", btn.Location.X.ToString() + Environment.NewLine + btn.Location.Y.ToString() + Environment.NewLine + btn.Size.Width.ToString() + Environment.NewLine + btn.Size.Height.ToString() + Environment.NewLine + btn.Text);
                }
But it only gets one control and none of the others.
Post Reply