如何在 VB 6 中使用打开文件对话框? [英] How to use open file dialog in VB 6?

查看:32
本文介绍了如何在 VB 6 中使用打开文件对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从目录或其他系统中选择一个文件.如何在 VB 6 中使用打开文件对话框?

I want to select a file from the directory or other system. How to use open file dialog in VB 6?

推荐答案

这个问题.引用:

在VB6中,添加组件:

In VB6, add the component:

  • 项目 > 组件
  • 在控件"选项卡上,选择 Microsoft 通用对话框控件 6.0 (SP6)

现在在您的表单上,从工具箱中添加新的通用对话框控件

Now on your form, add the new Common Dialog control from the toolbox

在代码中,您需要:

CommonDialog1.Filter = "Apps (*.txt)|*.txt|All files (*.*)|*.*"
CommonDialog1.DefaultExt = "txt"
CommonDialog1.DialogTitle = "Select File"
CommonDialog1.ShowOpen

'The FileName property gives you the variable you need to use
MsgBox CommonDialog1.FileName

这篇关于如何在 VB 6 中使用打开文件对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆