how do you make a subroutine or function that allows you to change the file that my.rescources."filename" uses?

here is my code
.................................................. .................................................. .................................................. ................................................
Public Sub mathwiz(ByRef z As Double)



Dim i1 As New Bitmap(z)
Dim i2 As New Bitmap(PictureBox1.Image)

For x As Integer = 1 To i1.Width - 1
For y As Integer = 1 To i1.Height - 1
Dim c1 As Color = i1.GetPixel(x, y)
Dim c2 As Color = i2.GetPixel(x, y)
Dim h As Single = (360 - Math.Abs(c1.GetHue - c2.GetHue)) / 360
Dim s As Single = 1 - Math.Abs(c1.GetSaturation - c2.GetSaturation)
Dim b As Single = 1 - Math.Abs(c1.GetBrightness - c2.GetBrightness)
avg += (h + s + b) / 3
Next
Next
Dim eq As Single = avg / (i1.Width * i1.Height)

i1.Dispose()
i2.Dispose()
End Sub
.................................................. .................................................. .................................................. ................................................
i would need to change "z" into My.Resources."whateveriwant" whenever i call this.