我尝试使用PromptUser
中Sub Sub Main
中的值,但不能。它说:
未为参数SaS指定参数
未声明EmailAddress,StudentName,SaS,并且由于保护级别可能无法访问
StudentName
,EmailAddress
和SaS
是数组:
Module Module1
Private StudentName(2) As String
Private EmailAddress(2) As String
Private SaS(2) As String
Public Sub PromptUser(ByVal StudentName() As String, ByVal EmailAddress() As String, ByVal SaS() As String)
For i = 0 to 2
Console.WriteLine("enter your name: ")
StudentName(i) = Console.ReadLine()
Console.WriteLine("enter your e-mail")
EmailAddress(i) = Console.ReadLine
SaS(i) = StudentName(i) & "#" & EmailAddress(i)
Next
End Sub
Sub Main()
Dim SSN1 As String
PromptUser(StudentName(), EmailAddress(), SaS())
For i = 0 to 2
Console.WriteLine("enter name to search: ")
SSN1 = Console.ReadLine()
If SSN1 = StudentName(i) Then
Console.WriteLine(SaS(i))
End If
Next
End Sub
End Module