在visual studio[VB.NET-初学者]中切换表单时出错

在visual studio[VB.NET-初学者]中切换表单时出错,vb.net,forms,encryption,Vb.net,Forms,Encryption,对于我的一个班级,我必须做一个小的加密程序。在我的程序中,我有三种形式:frmMenu、frmEncodage、frmChiffrement。程序启动时,弹出菜单窗体。之后,有一个组合框,可以让您在两种类型的加密之间进行选择。做出选择后,按一个按钮开始。遗憾的是,当我完成一个加密表单(frmEncodage)的编码时,当我在菜单中选择表单时,我的程序不允许我打开表单。出现错误: 创建表单时出错。有关详细信息,请参阅Exception.InnerException。错误为:从字符串“a”转换为类型

对于我的一个班级,我必须做一个小的加密程序。在我的程序中,我有三种形式:frmMenu、frmEncodage、frmChiffrement。程序启动时,弹出菜单窗体。之后,有一个组合框,可以让您在两种类型的加密之间进行选择。做出选择后,按一个按钮开始。遗憾的是,当我完成一个加密表单(frmEncodage)的编码时,当我在菜单中选择表单时,我的程序不允许我打开表单。出现错误: 创建表单时出错。有关详细信息,请参阅Exception.InnerException。错误为:从字符串“a”转换为类型“Integer”无效

我不知道如何修复它,我需要你的帮助。以下是我的frmMenu中的代码:

Private Sub btnDebuter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDebuter.Click
    If cbxMenuChoix.Text = "Rotation" Then
        Me.Hide()
        frmEncodage.Show()
    ElseIf cbxMenuChoix.Text = "Chiffrement par substitution" Then
        Me.Hide()
        FrmChiffrement.Show()
    Else
        MessageBox.Show("Veuillez entrer un choix d'encodage")
    End If
End Sub
这是frmEncodage的代码:

Dim boEncodageNeg, boMajuscule As Boolean
Dim inDecalage As Integer
Dim inProfondeur As Integer
Dim tbValeurLettre() As Integer = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
Dim byValeurFinal As Byte
Dim stInput, stLettre, stChaine As String
Dim inLettreNum As Integer


Private Sub btnRotRetour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRotRetour.Click
    Me.Hide()
    frmMenu.Show()
End Sub

Private Sub btnRotAide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRotAide.Click
End Sub

Private Sub btnRot13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRot13.Click

End Sub
Private Sub btnRotChiffrer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRotChiffrer.Click
    stInput = rtbRotInput.Text
    For i = 1 To stInput.Length - 1
        For ii = 0 To inProfondeur
            If ii = 0 Then
                stLettre = stInput.Chars(i)
            End If
            If stLettre = stLettre.ToUpper Then
                boMajuscule = True
            Else
                boMajuscule = False
            End If
            stLettre.ToLower()
            For iii = 0 To tbValeurLettre.Length - 1
                If stLettre = tbValeurLettre(iii) Then
                    inLettreNum = iii
                End If
            Next
            byValeurFinal = inDecalage + inLettreNum
            If byValeurFinal > 25 Then
                byValeurFinal = byValeurFinal - 25
            End If
            stLettre = tbValeurLettre(byValeurFinal)
        Next
        stChaine &= stLettre
    Next
    rtbRotOutput.Text = stChaine
End Sub
Private Sub btnRotDechiffrer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRotDechiffrer.Click

End Sub

问题在于这一行:

Dim tbValeurLettre() As Integer = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
您告诉计算机创建一个
Integer
s数组,但用
String
s(用引号括起来的文本片段)填充它。编写
“a”C
“b”C
等以创建可转换为
整数的