Salary Review project

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 1
Reputation: neongabby is an unknown quantity at this point 
Solved Threads: 0
neongabby neongabby is offline Offline
Newbie Poster

Salary Review project

 
0
  #1
Jun 25th, 2008
Hi all,

I am extremely new to vb.net. I've been mucking around with the below project. I have also attached the original instructions to give you a better idea of what I'm supposed to be doing Anywho, here is my code. given that I don't get the results I want, I know my code is messed up somewhere:

[code]Public Class mainForm
Private Sub mainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'add raise amounts to combo boxes
For raise As Integer = 1 To 10 Step 1
ComboBox1.Items.Add(raise.ToString)
Next
For raise As Integer = 1 To 10 Step 1
ComboBox2.Items.Add(raise.ToString)
Next
For raise As Integer = 1 To 10 Step 1
ComboBox3.Items.Add(raise.ToString)
Next

'display current salaries
Call ShowCurrentSalary()

End Sub
Private Function ShowProjection(ByVal salary As Decimal, _
ByVal raise As Decimal)

salary = salary * (1 + (raise * 0.01))
Return salary

End Function
Private Function GrantRaise(ByRef salary As Decimal, _
ByRef raise As Decimal)

salary = salary * (1 + (raise * 0.01))
Return salary
End Function
Private Sub ShowCurrentSalary()
Dim currentsalary1 As Decimal = 10000
Dim currentsalary2 As Decimal = 11500
Dim currentsalary3 As Decimal = 12300

current1Label.Text = currentsalary1.ToString("C2")
current2Label.Text = currentsalary2.ToString("C2")
current3Label.Text = currentsalary3.ToString("C2")

End Sub

Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub

Private Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
projected1Label.Text = String.Empty
projected2Label.Text = String.Empty
projected3Label.Text = String.Empty
End Sub

Private Sub projectedButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles projectedButton.Click
Dim salary As Decimal
Dim raise As Integer

Call ShowProjection(salary, raise)

projected1Label.Text = raise.ToString("C2")
projected2Label.Text = raise.ToString("C2")
projected3Label.Text = raise.ToString("C2")

Call ShowCurrentSalary()

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim raise As Integer
Dim assign As Boolean

'assign value of selected raise
assign = Decimal.TryParse(projected1Label.Text, raise)


End Sub

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Dim raise As Integer
Dim assign As Boolean

'assign value of selected raise
assign = Integer.TryParse(projected2Label.Text, raise)
End Sub

Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Dim raise As Integer
Dim assign As Boolean

'assign value of selected raise
assign = Decimal.TryParse(projected3Label.Text, raise)
End Sub

Private Sub grantButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grantButton.Click
Dim salary As Decimal
Dim raise As Integer

Call GrantRaise(salary, raise)

current1Label.Text = salary.ToString("C2")
current2Label.Text = salary.ToString("C2")
current3Label.Text = salary.ToString("C2")

Call ShowCurrentSalary()
End Sub
End Class[\code]
Last edited by neongabby; Jun 25th, 2008 at 3:46 pm.
Attached Files
File Type: doc Salary Review.doc (53.5 KB, 10 views)
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: oldyeller85 is an unknown quantity at this point 
Solved Threads: 0
oldyeller85 oldyeller85 is offline Offline
Newbie Poster

know what's wrong - not sure yet how to resolve

 
0
  #2
18 Days Ago
Originally Posted by neongabby View Post
Hi all,

I am extremely new to vb.net. I've been mucking around with the below project. I have also attached the original instructions to give you a better idea of what I'm supposed to be doing Anywho, here is my code. given that I don't get the results I want, I know my code is messed up somewhere:

[code]Public Class mainForm
Private Sub mainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'add raise amounts to combo boxes
For raise As Integer = 1 To 10 Step 1
ComboBox1.Items.Add(raise.ToString)
Next
For raise As Integer = 1 To 10 Step 1
ComboBox2.Items.Add(raise.ToString)
Next
For raise As Integer = 1 To 10 Step 1
ComboBox3.Items.Add(raise.ToString)
Next

'display current salaries
Call ShowCurrentSalary()

End Sub
Private Function ShowProjection(ByVal salary As Decimal, _
ByVal raise As Decimal)

salary = salary * (1 + (raise * 0.01))
Return salary

End Function
Private Function GrantRaise(ByRef salary As Decimal, _
ByRef raise As Decimal)

salary = salary * (1 + (raise * 0.01))
Return salary
End Function
Private Sub ShowCurrentSalary()
Dim currentsalary1 As Decimal = 10000
Dim currentsalary2 As Decimal = 11500
Dim currentsalary3 As Decimal = 12300

current1Label.Text = currentsalary1.ToString("C2")
current2Label.Text = currentsalary2.ToString("C2")
current3Label.Text = currentsalary3.ToString("C2")

End Sub

Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub

Private Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
projected1Label.Text = String.Empty
projected2Label.Text = String.Empty
projected3Label.Text = String.Empty
End Sub

Private Sub projectedButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles projectedButton.Click
Dim salary As Decimal
Dim raise As Integer

Call ShowProjection(salary, raise)

projected1Label.Text = raise.ToString("C2")
projected2Label.Text = raise.ToString("C2")
projected3Label.Text = raise.ToString("C2")

Call ShowCurrentSalary()

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim raise As Integer
Dim assign As Boolean

'assign value of selected raise
assign = Decimal.TryParse(projected1Label.Text, raise)


End Sub

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Dim raise As Integer
Dim assign As Boolean

'assign value of selected raise
assign = Integer.TryParse(projected2Label.Text, raise)
End Sub

Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Dim raise As Integer
Dim assign As Boolean

'assign value of selected raise
assign = Decimal.TryParse(projected3Label.Text, raise)
End Sub

Private Sub grantButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grantButton.Click
Dim salary As Decimal
Dim raise As Integer

Call GrantRaise(salary, raise)

current1Label.Text = salary.ToString("C2")
current2Label.Text = salary.ToString("C2")
current3Label.Text = salary.ToString("C2")

Call ShowCurrentSalary()
End Sub
End Class[\code]
____
salary was never assigned a value
If I figure this out I'll post the solution.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: oldyeller85 is an unknown quantity at this point 
Solved Threads: 0
oldyeller85 oldyeller85 is offline Offline
Newbie Poster
 
0
  #3
18 Days Ago
  1. Public Class MainForm
  2. Dim crntslry101 As Decimal = 10000
  3. Dim crntslry102 As Decimal = 11500
  4. Dim crntslry103 As Decimal = 12300
  5. Dim raise101 As Decimal
  6. Dim raise102 As Decimal
  7. Dim raise103 As Decimal
  8.  
  9.  
  10. Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11. 'add raise amounts to combo boxes
  12.  
  13. For raise As Integer = 1 To 10 Step 1
  14. prcntRazComboBox101.Items.Add(raise.ToString)
  15. Next
  16. For raise As Integer = 1 To 10 Step 1
  17. prcntRazComboBox102.Items.Add(raise.ToString)
  18. Next
  19. For raise As Integer = 1 To 10 Step 1
  20. prcntRazComboBox103.Items.Add(raise.ToString)
  21. Next
  22.  
  23. 'display current salaries
  24. ShowCurrentSalary()
  25.  
  26. End Sub
  27. Private Sub shProjSlryBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  28. Handles shProjSlryBtn.Click
  29. Dim salary As Decimal
  30. Dim raise As Integer
  31. If (String.Compare(prcntRazComboBox101.Text, "")) Then
  32. raise = Convert.ToInt32(prcntRazComboBox101.Text)
  33. projslryLbl101.Text = ShowProjection(crntslry101, raise)
  34. End If
  35. If (String.Compare(prcntRazComboBox102.Text, "")) Then
  36. raise = Convert.ToInt32(prcntRazComboBox102.Text)
  37. projslryLbl102.Text = ShowProjection(crntslry102, raise)
  38. End If
  39. If (String.Compare(prcntRazComboBox103.Text, "")) Then
  40. raise = Convert.ToInt32(prcntRazComboBox103.Text)
  41. projslryLbl103.Text = ShowProjection(crntslry103, raise)
  42. End If
  43.  
  44.  
  45. 'projslryLbl101.Text = raise.ToString("C2")
  46. 'projslryLbl102.Text = raise.ToString("C2")
  47. 'projslryLbl103.Text = raise.ToString("C2")
  48.  
  49. ShowCurrentSalary()
  50.  
  51. End Sub
  52. Private Sub ShowCurrentSalary()
  53. slryLbl101.Text = crntslry101.ToString("C2")
  54. slryLbl102.Text = crntslry102.ToString("C2")
  55. slryLbl103.Text = crntslry103.ToString("C2")
  56.  
  57. End Sub
  58. Private Function ShowProjection(ByVal salary As Decimal, _
  59. ByVal raise As Decimal)
  60.  
  61. salary = salary * (1 + (raise * 0.01))
  62. Return salary.ToString("C2")
  63.  
  64. End Function
  65. Private Function GrantRaise(ByRef salary As Decimal, _
  66. ByRef raise As Decimal)
  67.  
  68. salary = salary * (1 + (raise * 0.01))
  69. Return salary
  70. End Function
  71.  
  72. Private Sub prcntRazComboBox101_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  73. Handles prcntRazComboBox101.SelectedIndexChanged
  74. Dim raise As Integer
  75. Dim assign As Boolean
  76.  
  77. 'assign value of selected raise
  78. assign = Decimal.TryParse(projslryLbl101.Text, raise)
  79.  
  80. End Sub
  81. Private Sub prcntRazComboBox102_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  82. Handles prcntRazComboBox102.SelectedIndexChanged
  83. Dim raise As Integer
  84. Dim assign As Boolean
  85.  
  86. 'assign value of selected raise
  87. assign = Decimal.TryParse(projslryLbl102.Text, raise)
  88.  
  89. End Sub
  90. Private Sub prcntRazComboBox103_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  91. Handles prcntRazComboBox103.SelectedIndexChanged
  92. Dim raise As Integer
  93. Dim assign As Boolean
  94.  
  95. 'assign value of selected raise
  96. assign = Decimal.TryParse(projslryLbl103.Text, raise)
  97.  
  98. End Sub
  99.  
  100. Private Sub GrntRasBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  101. Handles GrntRasBtn.Click
  102. Dim raise As Integer
  103. If (String.Compare(prcntRazComboBox101.Text, "")) Then
  104. raise = Convert.ToInt32(prcntRazComboBox101.Text)
  105. slryLbl101.Text = ShowProjection(crntslry101, raise)
  106. End If
  107. If (String.Compare(prcntRazComboBox102.Text, "")) Then
  108. raise = Convert.ToInt32(prcntRazComboBox102.Text)
  109. slryLbl102.Text = ShowProjection(crntslry102, raise)
  110. End If
  111. If (String.Compare(prcntRazComboBox103.Text, "")) Then
  112. raise = Convert.ToInt32(prcntRazComboBox103.Text)
  113. slryLbl103.Text = ShowProjection(crntslry103, raise)
  114. End If
  115. End Sub
  116.  
  117.  
  118. Private Sub clrProjBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  119. Handles clrProjBtn.Click
  120. projslryLbl101.Text = ""
  121. projslryLbl102.Text = ""
  122. projslryLbl103.Text = ""
  123. End Sub
  124.  
  125. Private Sub exitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitBtn.Click
  126. Me.Close()
  127. End Sub
  128.  
  129.  
  130. End Class
Last edited by peter_budo; 17 Days Ago at 7:25 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC