Reputation: 111
In Visual Basic 2010, my program compiles without any problem. However, I get a warning "Not all code paths return a value" on function. Since our assignment requirement must submit without any error and warning so i need to solve these error.
Part of my sample code:
Dim i as integer = 0
Dim currentChar as string = frmMyCompiler.textbox.text(i)
Function toNextWord()
i = i + 1
currentChar = frmMyCompiler.textbox.text(i)
end Function
My function did not have any data type because it no need to return anything. Can VB use Void same as C++ ?? Anyone know how to overcome this problem?
Upvotes: 2
Views: 296
Reputation: 6079
Functions should always a return a value. As your using Function toNextWord () it has no return value.
Difference between Method and Function
Upvotes: 1