请问如何通过vb根据用户查询打开.txt文本?

fayeada 2002-10-08 10:42:36
我用的是shell("d:\winnt\Notepad.exe",a.txt)?有什么问题?为什么编不过去?
...全文
44 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
mouseanAnya 2002-10-08
  • 打赏
  • 举报
回复
Call Shell("Notepad.exe D:\newweb\" & request & ".txt", 1)
fayeada 2002-10-08
  • 打赏
  • 举报
回复
Call Shell("Notepad.exe D:\newweb\&request&".txt", 1)
我想这样生加。raceno.text接受用户的查询条件。可是不成呀?
fayeada 2002-10-08
  • 打赏
  • 举报
回复
Private Sub Command2_Click()
Dim request As String
If RaceNo.Text = "" Then
MsgBox " 输入要查询随机排位的场次"
Exit Sub
Else
request = RaceNo.Text
Call Shell("Notepad.exe D:\newweb\&request&".txt", 1)
End If
End Sub
shortppsy 2002-10-08
  • 打赏
  • 举报
回复
可以用command控件加上条件啊~
mouseanAnya 2002-10-08
  • 打赏
  • 举报
回复
在模块中添加下列声明:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Const SW_MAXIMIZE = 3

把你的代码修改为
ShellExecute 0, "open", "路径名称\a.txt", "", "", SW_MAXIMIZE

试一试
fayeada 2002-10-08
  • 打赏
  • 举报
回复
那用户的查询条件加在哪里呢?
easypower 2002-10-08
  • 打赏
  • 举报
回复
同意
shortppsy 2002-10-08
  • 打赏
  • 举报
回复
a=shell ("c:\windows\Notepad.exe")
这样可以,我试过~
crystalinpara 2002-10-08
  • 打赏
  • 举报
回复
shell "d:\winnt\Notepad.exe"+"a.txt"
zhengchong 2002-10-08
  • 打赏
  • 举报
回复
shell "Notepad.exe a.txt"
zhengchong 2002-10-08
  • 打赏
  • 举报
回复
shell "Notepad.exe a.txt")?

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧