public static string ShowNewDialog(string caption, string theValue)
        {
            NewDialog dlg = new NewDialog();

            dlg.Text         = caption;
            dlg.lblName.Text = caption;
            dlg.edtName.Text = theValue;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                return(dlg.edtName.Text);
            }

            return("");
        }
        private void btnMakeDir_Click(object sender, EventArgs e)
        {
            if (!sFtp1.Active)
            {
                return;
            }

            string s = NewDialog.ShowNewDialog("New Dir Name", "NewName");

            if (s != "")
            {
                sFtp1.MakeDir(s);
                FillDirList();
            }
        }
        private void btnRename_Click(object sender, EventArgs e)
        {
            if (!sFtp1.Active)
            {
                return;
            }

            if ((lbList.SelectedIndex > -1) &&
                (lbList.Items[lbList.SelectedIndex].ToString() != "") &&
                (lbList.Items[lbList.SelectedIndex].ToString()[0] != '/'))
            {
                string s = NewDialog.ShowNewDialog("New File Name", lbList.Items[lbList.SelectedIndex].ToString());

                if ((s != "") && (s != lbList.Items[lbList.SelectedIndex].ToString()))
                {
                    sFtp1.Rename(lbList.Items[lbList.SelectedIndex].ToString(), s);
                    FillDirList();
                }
            }
        }