如何在VB.NET中使用字符串? [英] How to use string in VB.NET?

查看:90
本文介绍了如何在VB.NET中使用字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我在vb.net上有问题



我将我的项目从vb 6转换为VB.net窗口应用



我结束时出现以下错误



Hi
I have issue in vb.net

I convert my project from vb 6 to VB.net window application

I have ended with the following error

Error	1	'String' is a class type and cannot be used as an expression.	G:\SARA_Project\VMS_SmartCard.NET\SmartCardNET\SmartCardNET\frmSmartCardReader.vb	SmartCardNET





此行错误



error in this line

buf = string(256, " ")





这个是我的代码.....





This is my code.....

<pre>     
        Dim ret As Long
        Dim buf As String
        Dim Add As String
        Dim ReaderPort1, ReaderPort2
        Dim fnum As Integer
        Dim buf1() As Byte
        Dim valueTemp As Integer
        valueTemp = 256

        ret = InitMyKADDLL()
        'Open Reader
        ReaderPort1 = "ACS ACR38USB 0"
        ReaderPort2 = "ACS ACR38USBSAM 0"
        ret = OpenMyKADReader(ReaderPort1, ReaderPort2)

        'Connect Card
        ret = ConnectMyKAD()

        If ret <> 0 Then

            ret = DisconnectMyKAD()
            ret = CloseMyKADReader()
            ret = FreeMyKADDLL()

            MsgBox("Please Insert My-Card before proceed!", vbCritical, "System Message")

            Exit Sub
        End If


        'Read Card ----------------------------------------------------
        'Name

    buf = string(256, " ")
        ret = HolderName(buf)
        If ret = 0 Then
            txtName.Text = Trim(buf)
        End If





请告诉我



谢谢



maideen



< b>我尝试了什么:





please advice me

Thank you

maideen

What I have tried:

Dim site As String = 256,"" 

推荐答案

使用 Strings.Space方法(Int32)(Microsoft.VisualBasic) [ ^ ]


这篇关于如何在VB.NET中使用字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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