新手一问?关于VB与HTML

新手一问?关于VB与HTML,第1张

VB是程序设计语言,

HTML是超文本标记语言.

两者相同的地方不多

不同的地方确有不少

对网页来说可能超文本标记语言更方便.

而要用计算机解决问题程序设计语言会更好!

用webbrower控件

请看下例

’声明:该程序由csdn论坛获得

dim dwinfolder as new shellwindows

dim withevents eventie as webbrowser_v1

private sub command1_click()

dim objie as object

for each objie in dwinfolder

if objie.locationurl = list1.list(list1.listindex) then

set eventie = objie

command1.enabled = false

list1.enabled = false

text1.text = ""

exit for

end if

next

end sub

private sub eventie_navigatecomplete(byval url as string)

text1.text = text1.text + chr(13) + chr(10) + url

end sub

在运行前。点击菜单 projects | references 项,在available references 列表中选择microsoft internet controls项将internet对象引用介入到工程中

private sub form_load()

dim objie as object

for each objie in dwinfolder

if instr(1, objie.fullname, "iexplore.exe", vbtextcompare) <> 0 then

list1.additem objie.locationurl

end if

next

command1.caption = "正文"

end sub

private sub form_unload(cancel as integer)

set dwinfolder = nothing

end sub

private sub list1_click()

dim objdoc as object

dim objie as object

for each objie in dwinfolder

if objie.locationurl = list1.list(list1.listindex) then

set objdoc = objie.document

for i = 1 to objdoc.all.length - 1

if objdoc.all(i).tagname = "body" then

text1.text = objdoc.all(i).innertext

end if

next

exit for

end if

next

end sub


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7662302.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-08
下一篇 2023-04-08

发表评论

登录后才能评论

评论列表(0条)

保存