VB Help

Enter Information into a text box and show List Box

Page 1 of 1

3 Replies - 432 Views - Last Post: 09 December 2009 - 01:08 PM Rate Topic: -----

#1 khull1989  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 19-May 09

VB Help

Post icon  Posted 09 December 2009 - 09:20 AM

Hello all,


I am having a hard time trying to figure out what code to use in a payroll calculator I am making. The requirements are

1. Name of employee.
2. number of hours worked
3. pay rate
4. percentage of state tax.
5. percentage of federal tax.
6. percentage of FICA tax.

I do not have any code, because I really don't understand exactly how i would go about this. Any help is appreciated.

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: VB Help

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 458
  • View blog
  • Posts: 4,222
  • Joined: 25-March 09

Re: VB Help

Posted 09 December 2009 - 09:35 AM

hello :)

can you help us by giving us the errors you have. the code where you have the errors. here on D.I.C we have the politic that we will not do your home work, work projects etc. You must show us some effort. Post the code you have trouble with in tags like so:

:code:

ty for helping us helping you :)

good luck with your project :)
Was This Post Helpful? 0
  • +
  • -

#3 khull1989  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 19-May 09

Re: VB Help

Posted 09 December 2009 - 10:41 AM

View PostNoBrain, on 9 Dec, 2009 - 08:35 AM, said:

hello :)

can you help us by giving us the errors you have. the code where you have the errors. here on D.I.C we have the politic that we will not do your home work, work projects etc. You must show us some effort. Post the code you have trouble with in tags like so:

:code:

ty for helping us helping you :)

good luck with your project :)


All I have right now is the validations for the input fields. I don't have any code for putting information into the list box because I don't really know how to go about it. All i have right now is this.

 Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
		Dim strFieldname As String
		'Dim 'mdecGrossPay As Decimal

		strFieldname = "Name"
		Call ValidateRequired(txtEmpName, strFieldname)

		lstEmployeeInfo.Items.Add("This will be a Test")

		strFieldname = "Hours Worked"

		If ValidateRequired(txtHoursWrk, strFieldname) Then
			If ValidNumber(txtHoursWrk, strFieldname) Then
				mdecHoursWorked = Convert.ToDecimal(txtHoursWrk.Text.Trim)
			End If
		End If

		strFieldname = "Pay Rate"

		If ValidateRequired(txtPayRate, strFieldname) Then
			If ValidNumber(txtPayRate, strFieldname) Then
				mdecPayRate = Convert.ToDecimal(txtPayRate.Text.Trim)
			End If
		End If

		strFieldname = "State Tax"

		If ValidateRequired(txtStateTx, strFieldname) Then
			If ValidNumber(txtStateTx, strFieldname) Then
				mdecStateTax = Convert.ToDecimal(txtStateTx.Text.Trim)
			End If
		End If

		strFieldname = "Federal Tax"

		If ValidateRequired(txtFedTx, strFieldname) Then
			If ValidNumber(txtFedTx, strFieldname) Then
				mdecFederalTax = Convert.ToDecimal(txtFedTx.Text.Trim)
			End If
		End If

		strFieldname = "FICA Tax"

		If ValidateRequired(txtFICATx, strFieldname) Then
			If ValidNumber(txtFICATx, strFieldname) Then
				mdecFICATax = Convert.ToDecimal(txtFICATx.Text.Trim)
			End If
		End If




	End Sub



I have every field i need validated but i don't know how to do the calculations and put them into the list box
Was This Post Helpful? 0
  • +
  • -

#4 sharpy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 394
  • Joined: 02-June 07

Re: VB Help

Posted 09 December 2009 - 01:08 PM

Hi

I think this is what you are trying to do

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim count As Integer = 0
		Dim total As Integer = 0
		Dim value1 As Integer = Str(TextBox1.Text)
		Dim value2 As Integer = Str(TextBox2.Text)
		Try
			Do Until count = 20
				total = total + (value1 + value2)

				ListBox1.Items.Add(total)
				count = count + 1
			Loop
		Catch ex As Exception

		End Try

	End Sub


I did this for clarity but add a listbox, a button and 2 textboxes. Add this code to the button sub

Hope this helps and points you in the right direction
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1