Any danish people in this forum?
Need help with a task.
Printable View
Any danish people in this forum?
Need help with a task.
Why do you want help from danish people only? This is a forum with people from all over the world, so english should always be used when posting.
You could describe your problem here and we'll try to help you the best we can.
It is because my english is very bad. But I'll try then.
The is a describtion of my task.
Make a funktion their can calculate, a salsman's provision. Then I have the sale, and the commision.
First off, that's better English than a lot of native speakers can manage to post.
As to the question, surely that's just a matter of finding a percentage. Multiplying a number and then dividing by 100 is the same all over, whether it's for sales commission or something else.
Public Function footbar(Sales As Integer) As Integer
Dim X As Integer
If (">500") Then GoTo 3
ElseIf Sales >= 500 And Sales <= 1000 Then
komm = 6
ElseIf Sales >= 1000 And Sales <= 2000 Then
komm = 9
ElseIf Sales >= 2000 And Sales <= 5000 Then
komm = 12
Else
If Sales >= 5000 Then komm 15
End If
End Function
Can somebody tell me, what is wrong? When I compile, it says: "Compile Error" "Else without if"
This line:is a self-contained statement. You cannot add an Else to that on another line. If you put anything after the "Then" part then it all has to be on the same line. If you want to use multiple lines then you can't have anything after the "Then" on the same line.vb.net Code:
If (">500") Then GoTo 3
That said, that code cant' do anything useful. What is that line going to do? It's checking the string ">500" and trying to evaluate ti as a Boolean. That just isn't going to do anything useful. Presumably you want to compare Sales to 500, but you're not doing anything like that. Also, there's really no justifiable reason for using a GoTo anywhere these days, and certainly not there. If you have a sliding scale then it should look like this:or this:vb.net Code:
If sales < 500 Then 'Do nothing. ElseIf sales < 1000 Then ElseIf sales < 2000 Then ElseIf sales < 5000 Then Else End Ifvb.net Code:
Select Case sales Case Is < 500 'Do nothing. Case Is < 1000 Case Is < 2000 Case Is < 5000 Case Else End Select
Ok, It works now. Thanks for the help!