vb 用CommonDialog1打开一个txt文件,并把它复制到text1.text中。

是,我不会用CommonDialog1 打开选中的文件。在某文件夹里有一个txt文件。想把它调到程序里。

首先用
CommonDialog1.ShowOpen
选中你需要的那个txt文件
然后用
CommonDialog1.FileName
得到路径以及文件名
就可以打开文件处理了

下面的代码供参考
Dim temp As String
Dim all As String
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
Do While Not EOF(1)
Input #1, temp
all = all & temp & Chr(13) & Chr(10)
Loop
Close #1
Text1.Text = all
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-04-16
楼上你这个问题是想问什么???代码??
相似回答