+ -
当前位置:首页 → 问答吧 → textbox里值的传递

textbox里值的传递

时间:2011-12-11

来源:互联网

C# code
 
主窗口form1有 控件textBox_path.Text 里存放着一个txt文件的路径
下面是 另一个窗口的代码
private void btnOK_Click(object sender, EventArgs e)//确定按钮事件
       {
           string path = ff.textBox_path.Text;//如何把主窗口form1里控件textBox_path.Text路径赋值给path?
           string newfile=text_content.Text;
           File.WriteAllText(path, newfile);//我想在其之前如何清空path路径下txt文件里的内容??
           this.Close();
       }

作者: taozi031   发布时间: 2011-12-11

子父窗体么

作者: zhaozheng1988   发布时间: 2011-12-11

ff窗体中,添加属性
C# code
public class OtherForm:Form
{
    public string FilePath
    {
        get
        {
            return textBox_path.Text;
        }
    }
}

作者: wuyazhe   发布时间: 2011-12-11

相关阅读 更多

热门下载

更多