Solved

Check my code out(2)

Posted on 2016-11-19
2
60 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Suggested Solutions

Title # Comments Views Activity
abstract class C# 1 44
c#  FTP ftpwebrequest URI invalid 6 38
Returning multiple values with a stored procedure 9 28
Which is best Image Resizing Web service 11 31
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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