|
-
Sep 9th, 2007, 05:22 AM
#1
Thread Starter
New Member
Vb Task
Any danish people in this forum?
Need help with a task.
-
Sep 9th, 2007, 05:35 AM
#2
Re: Vb 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.
-
Sep 9th, 2007, 05:59 AM
#3
Thread Starter
New Member
Re: Vb Task
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.
-
Sep 9th, 2007, 07:23 AM
#4
Re: Vb Task
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.
-
Sep 13th, 2007, 08:39 AM
#5
Thread Starter
New Member
Re: Vb Task
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"
-
Sep 13th, 2007, 06:19 PM
#6
Re: Vb Task
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.
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:
vb.net Code:
If sales < 500 Then
'Do nothing.
ElseIf sales < 1000 Then
ElseIf sales < 2000 Then
ElseIf sales < 5000 Then
Else
End If
or this:
vb.net Code:
Select Case sales
Case Is < 500
'Do nothing.
Case Is < 1000
Case Is < 2000
Case Is < 5000
Case Else
End Select
-
Sep 14th, 2007, 01:29 AM
#7
Thread Starter
New Member
Re: Vb Task
Ok, It works now. Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|