Quantcast
Viewing all articles
Browse latest Browse all 12583

Using 2 different forms

I am using 2 different forms and in the first form, the user can click a button and the other form pops up and allows the user to enter the height they want to set the textbox in form 1, but i cant get it to work. If you can please make the code as simple as possible and please explain that would be great. 

Form 1

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 Testing
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            EnterHeight eh = new EnterHeight();
            eh.ShowDialog();
            textBox1.Multiline = true;
            textBox1.Height = 50;
        }
        
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text != Text)
            {
                button1.Enabled = false;
            }
        }

        public void setTextboxHeight(int height)
        {
            EnterHeight eh = new EnterHeight();
            eh.ShowDialog();
        }
    }
}

Enter Height (form 2)

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 Testing
{
    public partial class EnterHeight : Form
    {
        public EnterHeight()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {

        }
    }
}


Viewing all articles
Browse latest Browse all 12583

Trending Articles