Solved

Check my code out(2)

Posted on 2016-11-19
2
57 Views
Last Modified: 2016-12-14
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Gallowey_Cute
{
    public partial class FormA : Form
    {
        public FormA()
        {
            InitializeComponent();
            FormA fa = new FormA();
            fa.StartPosition = FormStartPosition.CenterScreen;
            fa.WindowState = new FormWindowState();
            fa.WindowState = FormWindowState.Normal;
            fa.Cursor = Cursors.Arrow;
            fa.MaximizeBox = true;
            fa.MinimizeBox = true;
            fa.Visible = true;
            fa.Enabled = true;
            fa.BackColor = Color.Black;
            ReadOnlyButton.Enabled = false;
            ReadOnlyButton.BackColor = Color.Black;
            ReadOnlyButton.ForeColor = Color.White;
            Mainbutton.Enabled = true;
            Mainbutton.BackColor = Color.Black;
            Mainbutton.ForeColor = Color.White;
            textBox1.BackColor = Color.Black;
            textBox1.ForeColor = Color.White;
            textBox1.ReadOnly = false;
            fa.Text = ",";
            




        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            textBox1.BackColor = Color.Black;
            textBox1.ForeColor = Color.White;
        }

        private void Mainbutton_Click(object sender, EventArgs e)
        {
            FormA fa = new FormA();
           if (textBox1.Text==textBox1.Text+"I want to make a new file")
            {
                
            }
            
            if (textBox1.Text == textBox1.Text + "Maximize form = false;") 
            {
                fa.MaximizeBox = false;
            }
            if (textBox1.Text == textBox1.Text + "Minimize form = false;")
            {
                fa.MinimizeBox = false;
            }
            if (textBox1.Text == textBox1.Text + "Return to original Properties(0)")
            {
                fa.MaximizeBox = true;
                fa.MinimizeBox = true;
            }
            if (textBox1.Text == textBox1.Text + "Form Window State = Maximized")
            {
                fa.WindowState = FormWindowState.Maximized;
            }
            if (textBox1.Text == textBox1.Text +"Form Window State = Minimized")
            {
                fa.WindowState = FormWindowState.Minimized;
            }
            if (textBox1.Text == textBox1.Text + "Return to original Properties(1)")
            {
                fa.WindowState = FormWindowState.Normal;
            }
            if (textBox1.Text == textBox1.Text + "Cursors = Hand")
            {
                fa.Cursor = Cursors.Hand;
            }
            if (textBox1.Text == textBox1.Text +"Cursors = UpArrow")
            {
                fa.Cursor = Cursors.UpArrow;
            }
            if (textBox1.Text == textBox1.Text + "Return to original Properties(2)") 
            {
                fa.Cursor = Cursors.Arrow;
            }
            if (textBox1.Text == textBox1.Text +"Go away I dont need you anymore")
            {
                textBox1.ReadOnly = true;
                Mainbutton.Enabled = false;
                ReadOnlyButton.Enabled = true;
                
            }
            

        }

        private void ReadOnlyButton_Click(object sender, EventArgs e)
        {
            ReadOnlyButton.Enabled = false;
            textBox1.ReadOnly = false;
            Mainbutton.Enabled = true;

        }
    }
}

Open in new window

but if I don't use FormA  fa = new FormA()

its all wrong
0
Comment
Question by:Brian Smith
2 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 41894406
>>but if I don't use FormA  fa = new FormA()   its all wrong

As I pointed out in your earlier question that is creating an endless loop which blows the stack up - so it WRONG

What you might want is to use this. to refer to the current instance of the form.  But you don't say what you want so my guess could be not what you want either.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question