Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

Any Visual Basic programmers/gurus here?

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Sep-10-03 11:26 PM
Original message
Any Visual Basic programmers/gurus here?
I might need your help tonight. Just check in if you are one and available to help....

Thanks!

Hawkeye-X
Printer Friendly | Permalink |  | Top
niceypoo Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Sep-10-03 11:29 PM
Response to Original message
1. What with?
>>?????
Printer Friendly | Permalink |  | Top
 
rabid_nerd Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Sep-10-03 11:29 PM
Response to Original message
2. As long as it's not about Windows Messenger :)
..
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Sep-10-03 11:50 PM
Response to Reply #2
4. Naw. it's homework.
Edited on Wed Sep-10-03 11:52 PM by HawkeyeX
I need to write up a code for calculation button.

What it asks for is specifically:

Hell, let me phrase it out...

"The company has insituted a bonus program to give its employees an incentive to sell more. For every dollar the store makes in a four-week period, the employees receive 2% of the sales. The amount of bonus each employee received is based on the percentage of hours he or she worked during the bonus period (a total of 160 hours)."

The Calculate button will determine the bonus earned by this employee. Do not allow missing or bad input data to cancel the program; instead display a message to the user.

So far, I've designed the interface, and I have as follows, a text box for an employee's name, the total number of hours worked, and the amount of the store total sales, plus two buttons, the calculate and clear button. And of course, the label 'output' to display the bonus.

I can do the clear code pretty easily since it asks that I clear everything EXCEPT the amount of store's total sales...

All I need to figure out how to code in the Calculation buttons correctly.

Thanks in advance!

Hawkeye-X
Printer Friendly | Permalink |  | Top
 
Pert_UK Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Sep-10-03 11:49 PM
Response to Original message
3. I have some VERY basic VBA skills in an emergency.......
But don't rely on them!

P.
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Sep-11-03 12:15 AM
Response to Original message
5. kick
here's what I've got so far, and I don't think I got it quite right..

Const mdecBONUS_RATE As Decimal = 0.02D

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
'Calculate the bonus

Dim intHours As Integer
Dim decSalesAmt As Decimal
Dim decBonusAmt As Decimal

Try
'Convert input values to numeric variables
intHours = CInt(txtHours.Text)
decSalesAmt = CDec(txtSales.Text)

'Calculate the bonus
decBonusAmt = intHours * decSales
End Try


End Sub
Printer Friendly | Permalink |  | Top
 
GoodSpud Donating Member (153 posts) Send PM | Profile | Ignore Thu Sep-11-03 12:31 AM
Response to Reply #5
6. A couple of points...
Given that it is home work I won't help too much, unless you twist my arm....

Anyway here is what I see looking at what you have so far:

1. you are assuming that the employees only work whole hours. I don't know if that is a valid assumption.

2. You will need to add a 'Catch' to the 'Try' statement

3. The employee bonus should be calculated something like this: (Employee Percentage Worked) * (Available Bonus Pool). It seems like right now you aren't calculating either of these two terms.

I'll keep an eye on the thread if you need some more help.


TDPR
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Sep-11-03 12:57 AM
Response to Reply #6
8. Of course
Edited on Thu Sep-11-03 12:57 AM by HawkeyeX
I mispasted everything...

 Private Sub btnCalc_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCalc.Click
        'Calculate the bonus

        Dim intHours As Integer
        Dim decSalesAmt As Decimal
        Dim decBonusAmt As Decimal


        Try
            'Convert input values to numeric variables
            intHours = CInt(txtHours.Text)
            decSalesAmt = CDec(txtSales.Text)

            'Calculate the bonus
            decBonusAmt = decSalesAmt * mdecBONUS_RATE *
(intHours / 160) * 100

            'Format the bonus
            lblBonus.Text = FormatCurrency(decBonusAmt)

        Catch MyErr As InvalidCastException
            MessageBox.Show("Enter numeric data.",
"Data Entry Error", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
        Catch MyErr As Exception
            MessageBox.Show("Error: " &
MyErr.Message)
        End Try


    End Sub
Printer Friendly | Permalink |  | Top
 
hel Donating Member (266 posts) Send PM | Profile | Ignore Thu Sep-11-03 12:40 AM
Response to Reply #5
7. It should be something like
BonusAmt = TotalSales * BONUS_RATE * (Hours/160) * 100


I guess, try it out.


Good luck. :)
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Sep-11-03 12:59 AM
Response to Reply #7
9. Hmm didn't work
why the * 100? I think that's the real reason of inflation. Perhaps if I knocked it off, it would make some sense, no?

I mean, I put a total sales of like 1500, and it came out as a bonus of TWICE that much. I'd be willing to work for a company with this calculation error.

Hawkeye-X
Printer Friendly | Permalink |  | Top
 
GoodSpud Donating Member (153 posts) Send PM | Profile | Ignore Thu Sep-11-03 01:05 AM
Response to Reply #9
10. We should all be so luck!
Yeah, you need to loose the *100. You don't actually want the percentage just the raw decimal number.

I am not looking at your assignment so I don't know but I am still uncomfortable with the intHours = CInt(txtHours.Text) portion of your code.

Unless the instruction state that hours are rounded or some such thing I would assume that partial hours could occur. Just do a 'CDec' instead and you should be in good shape.

TDPR
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Sep-11-03 01:16 AM
Response to Reply #10
11. OK. you have a point
so I'll change that in a heartbeat. Thanks all!

Now I have to tackle a on-hand lab test tomorrow.

Hawkeye-X
Printer Friendly | Permalink |  | Top
 
GoodSpud Donating Member (153 posts) Send PM | Profile | Ignore Thu Sep-11-03 01:21 AM
Response to Reply #11
12. Good luck on the lab!
Now if I could just find someone willing to fix a dreadful database design error I made about 18 months ago and have been trying to code around for about a week... <sigh>

TDPR
Printer Friendly | Permalink |  | Top
 
Booberdawg Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Sep-11-03 01:39 AM
Response to Original message
13. Is this VB.NET??
There is no "Try and Catch" capability up to Version 6 of Visual Basic.
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Wed Apr 24th 2024, 09:56 AM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC