Results 1 to 3 of 3

Thread: Error BC30455 - What am I doing wrong?

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2018
    Posts
    51

    Question Error BC30455 - What am I doing wrong?

    I have this code here:



    Code:
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            RefreshList()
        End Sub
    
        Private Sub RefreshList()
            Dim procs() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses
            Dim f As String
    
            'as from @Visual Vincent's comment:
            ListBox1.BeginUpdate()
            ListBox1.Items.Clear()
    
            For Each proc As System.Diagnostics.Process In procs
                f = GetProcessFileName(proc)
                If f.Length > 0 Then
                    ListBox1.Items.Add(f)
                    ListBox1.Items.Add("MD5: " & GetMD5String(f))
                    ListBox1.Items.Add(String.Empty)
                End If
    
            Next
    
            ListBox1.EndUpdate()
    
        End Sub
    
        Private Function GetProcessFileName(proc As System.Diagnostics.Process) As String
            Dim strRet As String = String.Empty
    
            Try
                strRet = proc.MainModule.FileName
            Catch ex As Exception
                ' This catch used to ignore "Access is denied" exception.
            End Try
            Return strRet
        End Function
    
        Private Function GetMD5String(ByVal strFilename As String) As String
            Dim cMD5 = System.Security.Cryptography.MD5.Create
            Dim bytHash As Byte()
            Dim sb As New System.Text.StringBuilder
            Dim scanbox As New TextBox
            scanbox.Text = My.Computer.FileSystem.ReadAllText("viruslist.txt").ToString
    
            Using cStream As New IO.FileStream(strFilename, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
    
                bytHash = cMD5.ComputeHash(cStream)
            End Using
    
            For Each b In bytHash
                sb.Append(b.ToString("X2"))
            Next
    
            If scanbox.Text.Contains(sb.ToString) Then
                MessageBox.Show("Virus Detected!")
            End If
    
            Return sb.ToString
    
    
    
        End Function
    
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            Timer1.Enabled = False 'Stops the timer
            RefreshList()
            GetMD5String()
            Timer1.Enabled = True
        End Sub

    Under the GetMD5String() it's giving me error:


    BC30455 Visual Basic AND VB.NET Argument not specified for parameter 'strFileName' of 'Private Function GetMD5String(ByVal strFilename As String) As String'.
    What am I doing wrong?

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Error BC30455 - What am I doing wrong?

    In the function
    Code:
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            Timer1.Enabled = False 'Stops the timer
            RefreshList()
            GetMD5String()
            Timer1.Enabled = True
        End Sub
    You have the line GetMD5String() - this is throwing the error as the Sub GetMD5String is declared as taking a string parameter, therefore you need to pass in a string.

    This is the same error you had in http://www.vbforums.com/showthread.p...w-is-this-done and http://www.vbforums.com/showthread.p...ing)-As-String and has exactly the same fix.

  3. #3
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Error BC30455 - What am I doing wrong?

    Code:
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            Timer1.Enabled = False 'Stops the timer
            RefreshList()
            GetMD5String()
            Timer1.Enabled = True
        End Sub
    The root of the problem is that, inside your Timer code, you are calling GetMD5String() and passing it no parameter. Your GetMD5String Function requires a String be passed to it. The wording of the error message is quite specific and should have made that clear.

    That being said, near as I can tell, your RefreshList Sub handles everything related to getting the MD5 hashes of all of the running processes and updating the ListBox, so I can't see a reason for you to ever be calling GetMD5String() directly from your Timer, so you should probably just get rid of that line I've bolded above.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width