[RESOLVED] Help With 4 Simple Programs!
Hello, I am a beginner and I need to make 4 easy programs. Could someone please give me all the coding for the fallowing programs and/or send me the actual program if you do it? It would help greatly and be much appreciated. I must do these by Thursday night. Thank you!
1) Write a program which will allow you to display in a text box, four different fonts, four different font sizes, as well as italic, bold, and underline using check boxes.
2)Write a program which will allow you to enter text into a text box and change all the letters to lower case apart from the first one which should be in upper case. Use ucase$() and lcase$().
3) Write a program which allows you to input your marks for the 5 courses you are taking into 4 text boxes. Each box should have a label with the subject at the top. There should be label box with the label average on top, & a command button for calculating the average & displaying it in the label box.
4) Create a program which allows the user to select from 5 different types of coffee. Using option buttons, the user should then have a choice of making 5 additions to the coffee using check boxes (sugar, milk, chocolate syrup, chocolate granules, & cherry syrup). The program should be able to calculate the price using a command button.
Re: Help With 4 Simple Programs!
Welcome to Forums, darthmunky! :wave:
Not to discurrage you but we don't do homework for anybody - we only help solving problem(s) you may've encountered...
Do you have any idea as to where to start yet?
If not you may perhaps paste few textboxes onto your form and start playing with properties such Font, etc directly in the properties window - that may give an idea how to that same thing programmatically.
Come back when you have more specific questions and don't hesitate to ask.
It's just that you original post was a little too much.. :)
Good luck.
Re: Help With 4 Simple Programs!
I know what to put on the form, I just have no idea what the coding is.
Re: Help With 4 Simple Programs!
Add two checkboxes and one textbox (chkBold, chkUpperCase and Text1 respectively) to your form, then add the following code to your form and start checking and unchecking those checkboxes:
Code:
Option Explicit
Private Sub Form_Load()
chkBold.Caption = "Bold"
chkUpperCase.Caption = "Upper Case"
End Sub
Private Sub chkBold_Click()
Text1.Font.Bold = chkBold.Value
End Sub
Private Sub chkUpperCase_Click()
Text1.Text = IIf(chkUpperCase.Value = vbChecked, UCase(Text1.Text), LCase(Text1.Text))
End Sub
Re: Help With 4 Simple Programs!
2, 3 and 4 are very basic and you should have some idea of where to start unless you missed most of your classes. Give one of them a try, show us what you have and we'll help with your questions.
Re: Help With 4 Simple Programs!
Ok, I've done all of them except the 3rd one. I have the form all ready, I just don't have a clue what to put in the command button. Please help.
Re: Help With 4 Simple Programs!
You would sum up the values in the 4 textboxes, divide by 4, and place the result in the Caption of the "average" label.
Re: Help With 4 Simple Programs!
Actually I'm not sure I understand the task since it says
Write a program which allows you to input your marks for the 5 courses you are taking into 4 text boxes. Where do you put the 5th mark?
Re: Help With 4 Simple Programs!
I think it needs 20 textboxes. 4 per course.
Re: Help With 4 Simple Programs!
Quote:
Originally Posted by MartinLiss
Actually I'm not sure I understand the task since it says
Write a program which allows you to input your marks for the 5 courses you are taking into 4 text boxes. Where do you put the 5th mark?
Yeah, I'm guessing it's a typo on the sheet I got. I think he meant to put 5 text boxes.
Quote:
Originally Posted by MartinLiss
You would sum up the values in the 4 textboxes, divide by 4, and place the result in the Caption of the "average" label.
I don't know how to make the command button do that.
Re: Help With 4 Simple Programs!
since you want it to happen when you click the button, put code similar to this in your command button's Click event.
lblAverage.caption = (Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text)) / 5
Re: Help With 4 Simple Programs!
Code:
Private Sub Command1_Click()
Dim ctl As Control
Dim lngCount as Long
Dim sngTotal As Single
For Each ctl In Me.Controls
If TypeOf ctl Is Textbox Then
lngCount = lngCount + 1
sngTotal = sngTotal + Val(ctl.Text)
End If
Next
Set ctl = Nothing
lblAverage.Caption = Format(sngTotal / lngCount, "0.00")
End Sub
Re: Help With 4 Simple Programs!
Neither of those worked. Heres what I have...
-5 text boxes named txt1, txt2, txt3, txt4, and txt5
-1 command button named cmd1
-1 label box named lbldisplay
...and I just need the coding for the command button, I tried both of those and got errors. Thanks by the way for helping me with this.
Re: Help With 4 Simple Programs!
I have to ask; did you change the names in my code to match your names? If so what errors did you get?
Re: Help With 4 Simple Programs!
Yes, I did change the names so they match. It was the error where you can choose to debug or end, and when I chose debug, the whole line was highlighted yellow.
Re: Help With 4 Simple Programs!
And what - EXACTLY - was the error message?
Re: Help With 4 Simple Programs!
Why don't you zip up your project and attach it to a post.
1 Attachment(s)
Re: Help With 4 Simple Programs!
Ok, here is the project all zipped up.
Re: Help With 4 Simple Programs!
I was expecting to find code in your form but oh well. Just do this
Code:
Private Sub cmd1_Click()
lbldisplay.Caption = (Val(Txt1.Text) + Val(Txt2.Text) + Val(Txt3.Text) _
+ Val(Txt4.Text) + Val(Txt5.Text)) / 5
End Sub
Re: Help With 4 Simple Programs!
Yesss! It works! Thank you so much! You may be the reason I graduate. I appreciate all the help you've given me.
Re: Help With 4 Simple Programs!
You're welcome. Now that we've helped you, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer.