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
{
}
}
}
}
Form1で、このフォームとその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);
私はcrawlLocalyの新しいフォームでやりたいのですが、Form1をクリックして、新しいフォームで新しいフォームbutton1を開いたり表示したりすると、Enabled = falseになり、ユーザーが新しいForm button1のtextBoxに何かを入力すると、trueが有効になります。その場合にのみ、ユーザーは新しいフォームのbutton1をクリックしてOKになります(新しいフォームのボタンのテキストはOKです)。
新しいフォームでbutton1textchangedイベントで使用しようとしましたが、機能しませんでした。ボタンをクリックして初めてfalseになりました。