我想在TEXT2.TEXT文本框中输入一个字符窜后,程序执行命令打开一个.TXT的文件,并将文件里的内容与TEXT2.TEXT中的内容进行比较。如果打开的.TXT的文件里有与TEXT2.TEXT中这个相同的字符窜就报错“文件中已存在”。
谢谢!
2 个解决方案
#1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>求教一个VB比对的问题!</title>
<link href="http://c.csdn.net/bbs/t/5/t5.css" rel="stylesheet" type="text/css" />
<link href="http://www.csdn.net/images/favicon.ico" rel="SHORTCUT ICON" />
<script type="text/javascript">
var tinfo = {
pdate: "2009-07-26 12:13:14"
,sid: "33fa67ff-a665-455a-8789-c5b59c9d8d5a"
,tid: "ce76c8a1-9b8c-4396-9c1a-5ffec3e62190"
,ba: "VB"
,sa: "VB_Basic"
};
</script>
<script type="text/javascript" src="/u/t5/t5.js"></script>
<script type="text/javascript" src="http://counter.csdn.net/a/js/AreaCounter.js"></script>
</head>
<body id="bbscsdn_wrap">
<div class="tad">
<iframe id="Topic_Top" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" width="100%" height="0" src="/u/t5/include/ad1.asp" ></iframe>
</div>
<div class="nav">
<a href="#"><img src="http://c.csdn.net/bbs/t/5/i/pic_logo.gif" alt="" class="logo" /></a>
<ul class="txt">
<li><a href="http://www.csdn.net/" target="_blank">首页</a>|</li>
<li><a href="http://hi.csdn.net/" target="_blank">空间</a>|</li>
<li><a href="http://news.csdn.net/" target="_blank">新闻</a>|</li>
<li><a href="http://bbs.csdn.net/" target="_blank">论坛</a>|</li>
<li><a href="http://blog.csdn.net/" target="_blank">博客</a>|</li>
<li><a href="http://download.csdn.net/" target="_blank">下载</a>|</li>
<li><a href="http://book.csdn.net/" target="_blank">读书</a>|</li>
<li><a href="http://wz.csdn.net/" target="_blank">网摘</a>|</li>
<li><a href="http://live.csdn.net/" target="_blank">视频</a>|</li>
<li><a href="http://www.dearbook.com.cn/" target="_blank">书店</a>|</li>
<li><a href="http://www.programmer.com.cn/" target="_blank">程序员</a>|</li>
<li><a href="http://www.itliyu.com/" target="_blank">求职招聘</a>|</li>
<li><a href="http://prj.csdn.net/" target="_blank">项目交易</a>|</li>
<li><a href="http://training.csdn.net/" target="_blank">培训</a>|</li>
<li><a href="http://daohang.csdn.net/" target="_blank">网址</a></li>
</ul>
<ul class="user">
<li>欢迎您:<span><a href="http://hi.csdn.net/my.html" id="vName">游客</a></span><span id="exit" style="display:none">|<a href="https://forum.csdn.net/User/LoginOut.aspx">退出</a></span><span id="login">|<a href="http://passport.csdn.net/UserLogin.aspx">登录</a><a href="http://passport.csdn.net/CSDNUserRegister.aspx">注册</a></span>|<a href="http://community.csdn.net/Help/HelpCenter.htm" target="_blank">帮助</a>
<input name="key" type="text" onkeyup="GoKeyDown(event);" onblur="if(!this.value)this.value='这里也许就有你要的答案... ';return true;" onfocus="if(this.value=='这里也许就有你要的答案... ')this.value='';return true;" value="这里也许就有你要的答案... " size="25" />
<input type="image" class="btn" src="http://c.csdn.net/bbs/t/5/i/search1.gif" onclick="Search(event,'');return false;" />
<input type="image" class="btn" src="http://c.csdn.net/bbs/t/5/i/search2.gif" onclick="Search(event,'advanced');return false;" />
</li>
</ul>
</div>
<input type="hidden" id="hf_cardUrl" value="https://forum.csdn.net/PointForum/UserCard.ashx?user=" />
<div class="loc">
<p>
<!-- a href="http://wz.csdn.net/rxsg/index.aspx" target="_blank" onclick='LogClickCount(this,117);'><img src="http://c.csdn.net/bbs/t/5/i/rxsg.jpg" alt="热血三国" /></a -->
<a href="http://www.csdn.net/" target="_blank">CSDN</a>-<a href="http://community.csdn.net/" target="_blank">CSDN社区</a>-<a href="https://forum.csdn.net/BList/VB/" target="_blank">VB</a>-<a href="https://forum.csdn.net/SList/VB_Basic//" target="_blank">基础类</a>
</p>
</div>
<div class="fm">
<ul class="menu">
<li class="bt1"><a href="javascript:;" class="bt1">管理菜单<!--[if IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/Top/AddTop.aspx?url=http://topic.csdn.net/u/20090726/12/ce76c8a1-9b8c-4396-9c1a-5ffec3e62190.html&text=%e6%b1%82%e6%95%99%e4%b8%80%e4%b8%aaVB%e6%af%94%e5%af%b9%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%81§ionid=33fa67ff-a665-455a-8789-c5b59c9d8d5a',width:680,height:285,title:'置顶'});}catch(ex){}return false;">置顶</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/SetPrime.aspx?forumid=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicid=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&topicCreateDate=2009-07-26+12%3a13%3a14&v=13',width:400,height:300,title:'推荐'});}catch(ex){}return false;">推荐</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/SetNotPrime.aspx?topicid=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&forumid=33fa67ff-a665-455a-8789-c5b59c9d8d5a&postDate=2009-07-26+12%3a13%3a14&v=13',width:400,height:300,title:'取消推荐'});}catch(ex){}return false;">取消推荐</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/LockTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&v=13',width:425,height:330,title:'锁定'});}catch(ex){}return false;">锁定</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/UnlockTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&v=13',width:425,height:330,title:'解锁'});}catch(ex){}return false;">解锁</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/MoveTopic.aspx?fid=33fa67ff-a665-455a-8789-c5b59c9d8d5a&tid=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&date=2009-07-26+12%3a13%3a14',width:480,height:200,title:'移动'});}catch(ex){}return false;">移动</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/ModifyTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&v=13',width:670,height:655,title:'编辑'});}catch(ex){}return false;">编辑</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/DeleteTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190',width:425,height:330,title:'删除'});}catch(ex){}return false;">删除</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Forum/TopicAddPoint.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&date=2009-7-26 12:13:14&v=13',width:420,height:300,title:'帖子加分'});}catch(ex){}return false;">帖子加分</a></li>
<li><a id="a_head_recreate" href="https://forum.csdn.net/PointForum/BuildTopic.aspx?topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&postDate=2009-07-26+12%3a13%3a14&return=">生成帖子</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<li><a href="https://forum.csdn.net/PointForum/Manage/TopicManageView.aspx?forumID=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicID=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&date=2009-07-26+12%3a13%3a14&v=13" class="bt2">结 帖</a></li>
<li><a href="https://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=33fa67ff-a665-455a-8789-c5b59c9d8d5a" target="_blank" class="bt3">发 帖</a></li>
<li><a href="#r_achor" class="bt4" onclick="try{ReplyBoxFocus();return false}catch(ex){}">回 复</a></li>
</ul>
</div>
<div class="tit">
<h1><dfn><a href="javascript:;" onclick="try{addToWZ();}catch(ex){}return false;">收藏</a></dfn>
<cite><select onchange="changeViewMode(this);"><option value="5">不显示删除回复</option><option value="0">显示所有回复</option><option value="1">显示星级回复</option><option value="3">显示得分回复</option></select></cite>
<span class="prime" csdnid="prime"></span><span class="lock" csdnid="lock"></span>
<a name="top"></a>求教一个VB比对的问题!<em>[问题点数:<span csdnid="point">0</span>分<span csdnid="check"></span>]</em></h1>
</div>
<table cellspacing="0" cellpadding="0" class="mframe">
<tr>
<td rowspan="2" class="lf"><div class="df">
<ul>
<li class="center"><a href="http://hi.csdn.net/aukowguw" target="_blank" onclick='LogClickCount(this,111);'><img src="http://avatar.profile.csdn.net/0/5/B/2_aukowguw.jpg" onmouseover="try{showUserCard(this,'aukowguw')}catch(ex){};"/></a></li>
<li title="总技术分:0;总技术排名:3000000"><dfn><a href="http://hi.csdn.net/aukowguw" target="_blank" onclick='LogClickCount(this,111);'>aukowguw</a></dfn></li>
<li title="总技术分:0;总技术排名:3000000">(aukowguw)</li>
<li class="honor"></li>
<li title="总技术分:0;总技术排名:3000000">等 级:<img class="grade user1" alt="" src="http://c.csdn.net/bbs/t/5/i/blank.gif"/> </li>
<li>结帖率:<label onmouseover="showHint(this, '截至2009-07-26 12:13:14\n用户结帖率100.00%\n总发帖:0\n正常结帖:0\n未结帖:0\n')" onmouseout="hideHint(this)">100.00%</label></li>
<li><div class="medalregion"></div></li>
</ul>
</div></td>
<td class="rw">
<div class="fbart"><em>楼主</em>发表于:2009-07-26 12:13:14</div>
<table cellspacing="0" cellpadding="0" class="mtxt">
<tr><td csdnid="body" id="body"><div class="msgfont">求教各位DX帮忙: <br /> <br /> 我想在TEXT2.TEXT文本框中输入一个字符窜后,程序执行命令打开一个.TXT的文件,并将文件里的内容与TEXT2.TEXT中的内容进行比较。如果打开的.TXT的文件里有与TEXT2.TEXT中这个相同的字符窜就报错“文件中已存在”。 <br /> <br /> 谢谢!</div><!--End_body//--></td></tr>
<tr><td csdnid="link"></td></tr>
<tr><td csdnid="modify"></td></tr>
</table>
</td>
</tr>
</body>
</html>
#2
声明中
dim neirong
form_load方法中读取“打开的.TXT”内容,保存到变量neirong中,这个知道怎么读吧!
TEXT2_Change方法中增加
if instr(neirong,TEXT2.text)>0 then
msgbox “文件中已存在”
end if
当然TEXT2_KeyDown方法中处理可能会更好,可以进行取消输入操作
dim neirong
form_load方法中读取“打开的.TXT”内容,保存到变量neirong中,这个知道怎么读吧!
TEXT2_Change方法中增加
if instr(neirong,TEXT2.text)>0 then
msgbox “文件中已存在”
end if
当然TEXT2_KeyDown方法中处理可能会更好,可以进行取消输入操作
#1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>求教一个VB比对的问题!</title>
<link href="http://c.csdn.net/bbs/t/5/t5.css" rel="stylesheet" type="text/css" />
<link href="http://www.csdn.net/images/favicon.ico" rel="SHORTCUT ICON" />
<script type="text/javascript">
var tinfo = {
pdate: "2009-07-26 12:13:14"
,sid: "33fa67ff-a665-455a-8789-c5b59c9d8d5a"
,tid: "ce76c8a1-9b8c-4396-9c1a-5ffec3e62190"
,ba: "VB"
,sa: "VB_Basic"
};
</script>
<script type="text/javascript" src="/u/t5/t5.js"></script>
<script type="text/javascript" src="http://counter.csdn.net/a/js/AreaCounter.js"></script>
</head>
<body id="bbscsdn_wrap">
<div class="tad">
<iframe id="Topic_Top" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" width="100%" height="0" src="/u/t5/include/ad1.asp" ></iframe>
</div>
<div class="nav">
<a href="#"><img src="http://c.csdn.net/bbs/t/5/i/pic_logo.gif" alt="" class="logo" /></a>
<ul class="txt">
<li><a href="http://www.csdn.net/" target="_blank">首页</a>|</li>
<li><a href="http://hi.csdn.net/" target="_blank">空间</a>|</li>
<li><a href="http://news.csdn.net/" target="_blank">新闻</a>|</li>
<li><a href="http://bbs.csdn.net/" target="_blank">论坛</a>|</li>
<li><a href="http://blog.csdn.net/" target="_blank">博客</a>|</li>
<li><a href="http://download.csdn.net/" target="_blank">下载</a>|</li>
<li><a href="http://book.csdn.net/" target="_blank">读书</a>|</li>
<li><a href="http://wz.csdn.net/" target="_blank">网摘</a>|</li>
<li><a href="http://live.csdn.net/" target="_blank">视频</a>|</li>
<li><a href="http://www.dearbook.com.cn/" target="_blank">书店</a>|</li>
<li><a href="http://www.programmer.com.cn/" target="_blank">程序员</a>|</li>
<li><a href="http://www.itliyu.com/" target="_blank">求职招聘</a>|</li>
<li><a href="http://prj.csdn.net/" target="_blank">项目交易</a>|</li>
<li><a href="http://training.csdn.net/" target="_blank">培训</a>|</li>
<li><a href="http://daohang.csdn.net/" target="_blank">网址</a></li>
</ul>
<ul class="user">
<li>欢迎您:<span><a href="http://hi.csdn.net/my.html" id="vName">游客</a></span><span id="exit" style="display:none">|<a href="https://forum.csdn.net/User/LoginOut.aspx">退出</a></span><span id="login">|<a href="http://passport.csdn.net/UserLogin.aspx">登录</a><a href="http://passport.csdn.net/CSDNUserRegister.aspx">注册</a></span>|<a href="http://community.csdn.net/Help/HelpCenter.htm" target="_blank">帮助</a>
<input name="key" type="text" onkeyup="GoKeyDown(event);" onblur="if(!this.value)this.value='这里也许就有你要的答案... ';return true;" onfocus="if(this.value=='这里也许就有你要的答案... ')this.value='';return true;" value="这里也许就有你要的答案... " size="25" />
<input type="image" class="btn" src="http://c.csdn.net/bbs/t/5/i/search1.gif" onclick="Search(event,'');return false;" />
<input type="image" class="btn" src="http://c.csdn.net/bbs/t/5/i/search2.gif" onclick="Search(event,'advanced');return false;" />
</li>
</ul>
</div>
<input type="hidden" id="hf_cardUrl" value="https://forum.csdn.net/PointForum/UserCard.ashx?user=" />
<div class="loc">
<p>
<!-- a href="http://wz.csdn.net/rxsg/index.aspx" target="_blank" onclick='LogClickCount(this,117);'><img src="http://c.csdn.net/bbs/t/5/i/rxsg.jpg" alt="热血三国" /></a -->
<a href="http://www.csdn.net/" target="_blank">CSDN</a>-<a href="http://community.csdn.net/" target="_blank">CSDN社区</a>-<a href="https://forum.csdn.net/BList/VB/" target="_blank">VB</a>-<a href="https://forum.csdn.net/SList/VB_Basic//" target="_blank">基础类</a>
</p>
</div>
<div class="fm">
<ul class="menu">
<li class="bt1"><a href="javascript:;" class="bt1">管理菜单<!--[if IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/Top/AddTop.aspx?url=http://topic.csdn.net/u/20090726/12/ce76c8a1-9b8c-4396-9c1a-5ffec3e62190.html&text=%e6%b1%82%e6%95%99%e4%b8%80%e4%b8%aaVB%e6%af%94%e5%af%b9%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%81§ionid=33fa67ff-a665-455a-8789-c5b59c9d8d5a',width:680,height:285,title:'置顶'});}catch(ex){}return false;">置顶</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/SetPrime.aspx?forumid=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicid=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&topicCreateDate=2009-07-26+12%3a13%3a14&v=13',width:400,height:300,title:'推荐'});}catch(ex){}return false;">推荐</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/SetNotPrime.aspx?topicid=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&forumid=33fa67ff-a665-455a-8789-c5b59c9d8d5a&postDate=2009-07-26+12%3a13%3a14&v=13',width:400,height:300,title:'取消推荐'});}catch(ex){}return false;">取消推荐</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/LockTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&v=13',width:425,height:330,title:'锁定'});}catch(ex){}return false;">锁定</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/UnlockTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&v=13',width:425,height:330,title:'解锁'});}catch(ex){}return false;">解锁</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/MoveTopic.aspx?fid=33fa67ff-a665-455a-8789-c5b59c9d8d5a&tid=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&date=2009-07-26+12%3a13%3a14',width:480,height:200,title:'移动'});}catch(ex){}return false;">移动</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/ModifyTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&v=13',width:670,height:655,title:'编辑'});}catch(ex){}return false;">编辑</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Manage/DeleteTopic.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190',width:425,height:330,title:'删除'});}catch(ex){}return false;">删除</a></li>
<li><a href="javascript:;" onclick="try{showWindow({url:'https://forum.csdn.net/PointForum/Forum/TopicAddPoint.aspx?forumId=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&date=2009-7-26 12:13:14&v=13',width:420,height:300,title:'帖子加分'});}catch(ex){}return false;">帖子加分</a></li>
<li><a id="a_head_recreate" href="https://forum.csdn.net/PointForum/BuildTopic.aspx?topicId=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&postDate=2009-07-26+12%3a13%3a14&return=">生成帖子</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<li><a href="https://forum.csdn.net/PointForum/Manage/TopicManageView.aspx?forumID=33fa67ff-a665-455a-8789-c5b59c9d8d5a&topicID=ce76c8a1-9b8c-4396-9c1a-5ffec3e62190&date=2009-07-26+12%3a13%3a14&v=13" class="bt2">结 帖</a></li>
<li><a href="https://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=33fa67ff-a665-455a-8789-c5b59c9d8d5a" target="_blank" class="bt3">发 帖</a></li>
<li><a href="#r_achor" class="bt4" onclick="try{ReplyBoxFocus();return false}catch(ex){}">回 复</a></li>
</ul>
</div>
<div class="tit">
<h1><dfn><a href="javascript:;" onclick="try{addToWZ();}catch(ex){}return false;">收藏</a></dfn>
<cite><select onchange="changeViewMode(this);"><option value="5">不显示删除回复</option><option value="0">显示所有回复</option><option value="1">显示星级回复</option><option value="3">显示得分回复</option></select></cite>
<span class="prime" csdnid="prime"></span><span class="lock" csdnid="lock"></span>
<a name="top"></a>求教一个VB比对的问题!<em>[问题点数:<span csdnid="point">0</span>分<span csdnid="check"></span>]</em></h1>
</div>
<table cellspacing="0" cellpadding="0" class="mframe">
<tr>
<td rowspan="2" class="lf"><div class="df">
<ul>
<li class="center"><a href="http://hi.csdn.net/aukowguw" target="_blank" onclick='LogClickCount(this,111);'><img src="http://avatar.profile.csdn.net/0/5/B/2_aukowguw.jpg" onmouseover="try{showUserCard(this,'aukowguw')}catch(ex){};"/></a></li>
<li title="总技术分:0;总技术排名:3000000"><dfn><a href="http://hi.csdn.net/aukowguw" target="_blank" onclick='LogClickCount(this,111);'>aukowguw</a></dfn></li>
<li title="总技术分:0;总技术排名:3000000">(aukowguw)</li>
<li class="honor"></li>
<li title="总技术分:0;总技术排名:3000000">等 级:<img class="grade user1" alt="" src="http://c.csdn.net/bbs/t/5/i/blank.gif"/> </li>
<li>结帖率:<label onmouseover="showHint(this, '截至2009-07-26 12:13:14\n用户结帖率100.00%\n总发帖:0\n正常结帖:0\n未结帖:0\n')" onmouseout="hideHint(this)">100.00%</label></li>
<li><div class="medalregion"></div></li>
</ul>
</div></td>
<td class="rw">
<div class="fbart"><em>楼主</em>发表于:2009-07-26 12:13:14</div>
<table cellspacing="0" cellpadding="0" class="mtxt">
<tr><td csdnid="body" id="body"><div class="msgfont">求教各位DX帮忙: <br /> <br /> 我想在TEXT2.TEXT文本框中输入一个字符窜后,程序执行命令打开一个.TXT的文件,并将文件里的内容与TEXT2.TEXT中的内容进行比较。如果打开的.TXT的文件里有与TEXT2.TEXT中这个相同的字符窜就报错“文件中已存在”。 <br /> <br /> 谢谢!</div><!--End_body//--></td></tr>
<tr><td csdnid="link"></td></tr>
<tr><td csdnid="modify"></td></tr>
</table>
</td>
</tr>
</body>
</html>
#2
声明中
dim neirong
form_load方法中读取“打开的.TXT”内容,保存到变量neirong中,这个知道怎么读吧!
TEXT2_Change方法中增加
if instr(neirong,TEXT2.text)>0 then
msgbox “文件中已存在”
end if
当然TEXT2_KeyDown方法中处理可能会更好,可以进行取消输入操作
dim neirong
form_load方法中读取“打开的.TXT”内容,保存到变量neirong中,这个知道怎么读吧!
TEXT2_Change方法中增加
if instr(neirong,TEXT2.text)>0 then
msgbox “文件中已存在”
end if
当然TEXT2_KeyDown方法中处理可能会更好,可以进行取消输入操作