Results 1 to 21 of 21

Thread: [RESOLVED] Help With 4 Simple Programs!

  1. #1

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    Resolved [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.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Help With 4 Simple Programs!

    Welcome to Forums, darthmunky!

    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.

  3. #3

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    Re: Help With 4 Simple Programs!

    I know what to put on the form, I just have no idea what the coding is.

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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.

  6. #6

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    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.

  7. #7

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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?

  9. #9
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872

    Re: Help With 4 Simple Programs!

    I think it needs 20 textboxes. 4 per course.
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  10. #10

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    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.

  11. #11
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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

  12. #12
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    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

  13. #13

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    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.
    Last edited by darthmunky; Jun 14th, 2007 at 02:23 PM.

  14. #14

  15. #15

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    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.

  16. #16
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Help With 4 Simple Programs!

    And what - EXACTLY - was the error message?
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  17. #17

  18. #18

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    Re: Help With 4 Simple Programs!

    Ok, here is the project all zipped up.
    Attached Files Attached Files

  19. #19
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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

  20. #20

    Thread Starter
    New Member darthmunky's Avatar
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    8

    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.

  21. #21
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width