Solved

Check my code out(2)

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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…

773 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