|
Your time now: Mon Nov 23, 2009 3:04 pm
|
View unanswered posts | View active topics
| Author |
Message |
|
jmvhbassist
|
Post subject: I desperately need help with a problem Posted: Wed Oct 07, 2009 7:23 pm |
|
Joined: Wed Oct 07, 2009 7:15 pm Posts: 1
|
|
Someone is hired for a job and agrees to pay one penny for the first day, two pennies for the second day, four pennies for the third day, and continuing to double each day. I need an application that allows the user to select/enter from a combo box the number of days the person will work and calculates the total pay.
|
|
| Top |
|
 |
|
pachecf
|
Post subject: Re: I desperately need help with a problem Posted: Fri Oct 09, 2009 1:10 am |
|
Joined: Thu Oct 08, 2009 9:18 pm Posts: 6
|
|
This is simple:
1. add a combo box to your form (combobox1) 2. double click your form and add the following to the form load event
'This will add the numbers from 1 to 100 to the combo box for selection For x = 1 To 100 ComboBox1.Items.Add(x) Next
3. add a text box (TextBox1) to your form 4. double click on your combobox1 control and add the following script to the ComboBox1_SelectedIndexChanged event
Dim x, y, z As Integer x = ComboBox1.Text x = x - 1 If x >= 2 Then z = 1 For y = 1 To x z = z * 2 Next ElseIf x = 0 Then z = 1 ElseIf x = 1 Then z = 2 End If TextBox1.Text = z
5 Test it !
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
|