I am getting undeclared variable errors with my code and I don't know why! The variables are declared above, but when being used, they are not found! The error in question occurs on the variables with two stars
If hour >= 10 Then
Dim hourAnn = My.Resources.ResourceManager.GetObject("_" + hour.ToString)
Else
Dim hourAnn = My.Resources.ResourceManager.GetObject("_0" + hour.ToString)
End If
If minute >= 10 Then
Dim minuteAnn = My.Resources.ResourceManager.GetObject("_" + minute.ToString)
Else
Dim minuteAnn = My.Resources.ResourceManager.GetObject("_" + minute.ToString)
End If
'Ann Type
If annType = 1 Then
My.Computer.Audio.Play(My.Resources.nowApproachPlatform, AudioPlayMode.WaitToComplete) 'The train now approaching platform
My.Computer.Audio.Play(platformAnn, AudioPlayMode.WaitToComplete) 'x
My.Computer.Audio.Play(My.Resources.isThe, AudioPlayMode.WaitToComplete) 'is the
My.Computer.Audio.Play(**hourAnn**, AudioPlayMode.WaitToComplete) '<hour>
My.Computer.Audio.Play(**minuteAnn**, AudioPlayMode.WaitToComplete) '<min>
If
statement creates a new block scope, sohourAnn
andminuteAnn
go out of scope immediately after they are declaredIf
statement at the bottom :)