本文介绍了我一直遇到这个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.

Error1Name 'vbUnicode' is not declared.C:\Users\Juss\Desktop\Project1.NET\Module1.vb1048Project1
Error2Name 'vbUnicode' is not declared.C:\Users\Juss\Desktop\Project1.NET\Module1.vb1851Project1

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

推荐答案

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的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 02:16