将vb6转换为vb.net

问题描述:

我是这个领域的新手,将vb项目转换为vb.net时出现错误
这是vb编码

-------------------------------------------------- ---------------------------------

i am new to this field, while converting a vb project to vb.net i got a error
this is the vb coding

-----------------------------------------------------------------------------------

Private Sub Command4_Click()
    Frame1.Visible = False
'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
Dim mailman As New ChilkatMailMan2

mailman.UnlockComponent "UnlockCode"

mailman.MailHost = txtPopserver.Text '"pop.gmail.com"
mailman.PopUsername = txtpoplogin.Text
mailman.PopPassword = txtpoppass.Text
mailman.PopSsl = 1 ' Use this for gmail
mailman.MailPort = 995 'Use this for gmail


Dim bundle As ChilkatEmailBundle2
'  Copy the all email from the user's POP3 mailbox
'  into a bundle object.  The email remains on the server.
Set bundle = mailman.CopyMail()

If (bundle Is Nothing) Then
    MsgBox mailman.LastErrorText
Exit Sub
End If

Dim i As Long
Dim Str As String
Dim LvItem As ListItem
Dim email As ChilkatEmail2
Form2.ListView1.ListItems.Clear
For i = 0 To bundle.MessageCount - 1
    Set email = bundle.GetEmail(i)
    Set LvItem = Form2.ListView1.ListItems.Add
    LvItem.Text = email.From
    LvItem.SubItems(1) = email.subject
    LvItem.SubItems(2) = i
Next
mailman.Pop3EndSession
Form2.Show
'Unload Me
End Sub
-----------------------------------------------------------------------------------


after converting it to vb.net 

-----------------------------------------------------------------------------------
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        GroupBox3.Visible = False
        '  The mailman object is used for receiving (POP3)
        '  and sending (SMTP) email.
        Dim mailman As New CHILKATMAILLib2.ChilkatMailMan2

        mailman.UnlockComponent("UnlockCode")

        mailman.MailHost = TextBox10.Text '"pop.gmail.com"
        mailman.PopUsername = TextBox12.Text
        mailman.PopPassword = TextBox11.Text
        mailman.PopSsl = 1 ' Use this for gmail
        mailman.MailPort = 995 'Use this for gmail


        Dim bundle As CHILKATMAILLib2.ChilkatEmailBundle2
        '  Copy the all email from the user's POP3 mailbox
        '  into a bundle object.  The email remains on the server.
        bundle = mailman.CopyMail()

        If (bundle Is Nothing) Then
            MsgBox(mailman.LastErrorText)
            Exit Sub
        End If

        Dim i As Integer

        'UPGRADE_NOTE: Str was upgraded to Str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'

        Dim LvItem As System.Windows.Forms.ListViewItem
        Dim email As CHILKATMAILLib2.ChilkatEmail2
        Form2.ListView1.Items.Clear()
        For i = 0 To bundle.MessageCount - 1
            email = bundle.GetEmail(i)
           

 'UPGRADE_ISSUE: MSComctlLib.ListItems method ListView1.ListItems.Add was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'


            LvItem = Form2.ListView1.Items.Add()
            LvItem.Text = email.From
            

'UPGRADE_WARNING: Lower bound of collection LvItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
           

            If LvItem.SubItems.Count > 1 Then
                LvItem.SubItems(1).Text = email.subject
            Else
                LvItem.SubItems.Insert(1, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, email.subject))
            End If
            


'UPGRADE_WARNING: Lower bound of collection LvItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
           


           If LvItem.SubItems.Count > 2 Then
                LvItem.SubItems(2).Text = CStr(i)
            Else
                LvItem.SubItems.Insert(2, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, CStr(i)))
            End If
        Next
        mailman.Pop3EndSession()
        Form2.Show()

    End Sub
--------------

-------------------------------- -------------------------------------
我此时出现错误
LvItem = Form2.ListView1.Items.Add()
错误是
Error 1 Overload resolution failed because no accessible ''Add'' accepts this number of arguments

---------------------------------------------------------------------
I got error at this point
LvItem = Form2.ListView1.Items.Add()
AND THE ERROR IS
Error 1 Overload resolution failed because no accessible ''Add'' accepts this number of arguments

在.Net中,您需要将参数传递给Add 方法.此参数是添加到ListView的项目.
此处 [
In .Net, you need to pass an argument to the Add method. This argument is the item that is added to the ListView.
Here[^] is an example.