vb:怎么把text内容保存

来源:百度知道 编辑:UC知道 时间:2024/05/10 17:54:43
一个按钮,一个text
单击按钮,出现一个保存对话框,可以改变文件名和保存路径,而保存文件类型是txt。
没有文件名啊,也没有txt类型啊

用 Commondialog控件
部件中,添加 Microsoft Common Dialog 6.0.并将其添加到窗体中
Private Sub Command1_Click()
With CommonDialog1
.ShowSave
If Len(.FileName)>0 Then
Open .FileName for output As #1
Print #1,Text1.Text
Close #1
End If
End With
End Sub