Solved

Check my code out(2)

Posted on 2016-11-19
2
59 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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