using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace GatherLinks
{
public partial class CrawlLocaly : Form
{
public CrawlLocaly()
{
InitializeComponent();
}
public string getText()
{
return textBox1.Text;
}
private void button1_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textBox1.Text))
{
DialogResult = DialogResult.OK;
}
else
{
}
}
}
}
In Form1 i Show this Form and its textBox:
private void button6_Click(object sender, EventArgs e)
{
using (var w = new StreamWriter(keywords))
{
crawlLocaly1 = new CrawlLocaly();
crawlLocaly1.StartPosition = FormStartPosition.CenterParent;
DialogResult dr = crawlLocaly1.ShowDialog(this);
I want to do in the crawlLocaly new Form that when i click in Form1 and open/show the new Form button1 on the new Form will be Enabled = false and once the user typed anything in the textBox in the new Form button1 will be enabled true and only then the user will able to click on the button1 in the new Form wich is OK(the text of the button in the new Form is OK).
Tried in the new Form to use on the button1 textchanged event but it didnt work. the button became false only after i clicked on it.
You can try with this code – based on
TextChanged eventNota : Initialize Button.Enabled to false; on control