この場合、ディレクトリを選択すると、label4 に選択したディレクトリ名が表示されます。
private void button2_Click(object sender, EventArgs e)
{
this.folderBrowserDialog1.Description = "Select the directory that you are want to use as default and please verify if the chosen directory is accessible";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
string message = "Are you sure you want to select this directory ?";
string caption = "Operation cancelled";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
result = MessageBox.Show(message, caption, buttons);
if (result == System.Windows.Forms.DialogResult.Yes)
{
mainUrl = folderBrowserDialog1.SelectedPath;
label4.Text = mainUrl;
}
}
}
しかし、同じ考えで何かが欲しいのですが、ウェブサイトのリンクアドレスを入力します。たとえば、ユーザーがボタンをクリックすると、textBox などが開きます。次に、ユーザーは Web サイトのアドレスを入力するか、リンクを貼り付けてクリックし、確認を求めてから label4 で撮影します。