Мне может понадобиться более подробная информация по этому вопросу, но похоже, что все не в порядке.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'program to add prices to get a receipt
'declare variables
Dim price1 As Single
Dim price2 As Single
Dim price3 As Single
Dim receipt As Single
'call procedures
'commenting this out - Call get_prices(price1, price2, price3)
'Please note the order of this, now this should get your value and validate!
price1 = validateprice(price1)
price2 = validateprice(price2)
price3 = validateprice(price3)
Call calculate_receipt(price1, price2, price3, receipt)
Call display_receipt(receipt)
End Sub
Кроме того, закомментируйте эту строку
'MsgBox("Incorrect value. Enter again.") 'so you can have it ask in the same place.
Вы можете предоставить подсказку как значение тоже.
'function validate price
Function validateprice(price, prompt)
Do
If price < 2 Or price > 49.99 Then
'MsgBox("Incorrect value. Enter again.")
price = InputBox(prompt)
End If
Loop Until price >= 2 And price <= 49.99
validateprice = price
End Function