我一直遇到这个vbUnicode的问题 [英] I've been having trouble with this vbUnicode

查看:162
本文介绍了我一直遇到这个vbUnicode的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Option Strict Off
Option Explicit On
Module Module1
	Dim winhttp As New WinHttp.WinHttpRequest
	Public Function Version() As Boolean
		Dim WebVer As Object
		On Error Resume Next
        winhttp.Open("GET", "http://www.********.com/upd/webver.txt")
		winhttp.Send()
        WebVer = StrConv(winhttp.ResponseBody, vbUnicode)
		Form1.WebVer.Text = WebVer
	End Function
	Public Function Version2() As Boolean
		Dim ClientVer As Object
		On Error Resume Next
        winhttp.Open("GET", "http://www.********.com/upd/clientver.txt")
		winhttp.Send()
        ClientVer = StrConv(winhttp.ResponseBody, vbUnicode)
		Form1.ClientVer.Text = ClientVer
	End Function
End Module





它给了我2个错误。



错误1 名称'vbUnicode'未声明.C:\ Users \ Juss \Desktop \ Project1.NET\Module1.vb 10 48项目1

错误2 未声明名称'vbUnicode'。 C:\ Users \ Juss \Desktop \ Project1.NET\Module1.vb 18 51 Project1



我真的很新,所有帮助真的很适合!



And it gives me 2 errors.

Error 1 Name 'vbUnicode' is not declared.C:\Users\Juss\Desktop\Project1.NET\Module1.vb 10 48 Project1
Error 2 Name 'vbUnicode' is not declared. C:\Users\Juss\Desktop\Project1.NET\Module1.vb 18 51 Project1

I'm really new in this, and all the help would be really appriciated!

推荐答案

你不需要 WinHttp 引用 - .NET框架有很多内置的课程可以帮到你。例如, DownloadString 方法 [ <的窗口> ^ ] code> System.Net.WebClient class [ ^ ]:

You don't need the WinHttp reference - the .NET framework has plenty of built-in classes to do this for you. For example, the DownloadString method[^] from the System.Net.WebClient class[^]:
Option Strict On
Option Explicit On

Imports System.Net

Module Module1
    Public Function Version() As Boolean
        Dim wc As New WebClient()
        Dim WebVer As String = wc.DownloadString("http://www.********.com/upd/webver.txt")
        Form1.WebVer.Text = WebVer
        
        Return True ' Functions need to return a value.
    End Function

    Public Function Version2() As Boolean
        Dim wc As New WebClient()
        Dim ClientVer As String = wc.DownloadString("http://www.********.com/upd/clientver.txt")
        Form1.ClientVer.Text = ClientVer
        
        Return True ' Functions need to return a value.
    End Function
End Module


vbUnicode 是内置的constans之一。需要引用 VBE7.dll



如需了解更多信息,请参阅: Visual Basic for Applications参考:StrConv函数 [ ^ ]
vbUnicode is one of built-in constans. A reference to VBE7.dll is needed.

For further information, please see: Visual Basic for Applications Reference: StrConv function[^]


这篇关于我一直遇到这个vbUnicode的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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