Student... looking for help, but definitely not answers
I am working on a few assignments for Visual Basic 2008. The book just doesn't give me enough example. I learn by example best and this is a new "web-enhanced" course where we are only in the classroom every other week for 3 hours. This being said I don't get a lot from reading a book, I learn much more from example. With that here is the program I am working on:
3 list boxes, 4 buttons, 2 labels.
The application allows the user to select a workshop from lstWorkshop, Then select a location from lstLocation. Next btnAdd takes the selected workshop and location attached to a set amount of days and a registration fee and multiplies the days by a Lodging fee and outputs this number in dollar form. After multiple workshops/locations have been added btnCalc adds each of these and places them in lblTotal. The other two buttons are exit and clear which have already understand (of course the "easy" stuff)
Here is my code:
Public Class Form1
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
'Declare values from both listboxes
Dim Day, Fee, Stay, Total As Integer
Dim workshop As String = lstWorkshop.SelectedIndex()
If lstWorkshop.SelectedItem = "Handling Stress" Then
Day = 3 And Fee = 595
ElseIf lstWorkshop.SelectedItem = "Time Management" Then
Day = 3 And Fee = 695
ElseIf lstWorkshop.SelectedItem = "Supervision Skills" Then
Day = 3 And Fee = 995
ElseIf lstWorkshop.SelectedItem = "Negotiation" Then
Day = 5 And Fee = 1295
ElseIf lstWorkshop.SelectedItem = "How to Interview" Then
Day = 1 And Fee = 395
ElseIf lstWorkshop.SelectedItem Is Nothing Then
MsgBox("Please choose a workshop first")
Dim location As String = lstLocation.SelectedIndex()
If lstLocation.SelectedItem = "Austin" Then
Stay = Day * 95
ElseIf lstLocation.SelectedItem = "Chicago" Then
Stay = Day * 125
ElseIf lstLocation.SelectedItem = "Dallas" Then
Stay = Day * 110
ElseIf lstLocation.SelectedItem = "Orlando" Then
Stay = Day * 100
ElseIf lstLocation.SelectedItem = "Phoenix" Then
Stay = Day * 92
ElseIf lstLocation.SelectedItem = "Raleigh" Then
Stay = Day * 90
ElseIf lstLocation.SelectedItem Is Nothing Then
MsgBox("Please choose a location first")
Total = Stay + Fee
'Display in list box
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
lstLocation.SetSelected(0, False) ' clear all listboxes and Total label
lblTCost.Text = ""
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close() 'exit application
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
My btnAdd button will only place "$0.00 in the third listbox from there I am stuck... Please if you care to take the time and read this and help me please explain that will be the most help of all. Thank you all for your time
Last edited by Cerian Knight; 11-16-2010 at 09:34 PM.
Reason: Added [code]...[/code] tags
And if your course is rubbish, the only thing you do by trying to copy/paste your way to some credit is swell their number of "satisfied customers". The only way to change things is to stick it to them and demand a refund, laying out your proof that you've spent your two weeks studying the course material and your 3 hours of course time trying to squeeze answers out of the instructor. If you don't prove that, they might claim you spent your two weeks goofing off then showed up unprepared for the 3 hour classroom time and spent it fiddling with your phone instead and refuse a refund. Obviously this would be more effective if you can get a few of your friends (maybe the other 2 guys who had exactly the same problem) to show up at the same time as you and demand a refund as well.
I don't know what you paid for the course, but there's $50 VB .NET books that are full of examples you could have bought instead; I'd be willing to wager you could have bought 3 or 4 for the cost of the course.
Thank you for your response. I am excited to get home and work on this code now. I appreciate at least linking me to a better explaination. I am on my lunch break at work and can not get to my code right now but it will be the first thing I do tonight.
In my defense, my code is MY code. How unique could the code be, it is a couple groups of IF statements, and could of clear statement and an exit statement. Give me a little credit, I said I was NOT here for answers only some explaination and a nudge in the right direction. I just recently joined this forum , as short while ago, in the attempt receive a little help not the answer.
I have had this instructor before and if there was another option I would take it, however I am stuck becasue he is the only one teaching the course, and it is only offered as a "web enhanced class" he has never explained things well enough for me to understand, but everyone learns differently. This is a community college so "sticking it to them" is not really an option, I need classes to complete an associates degree. These are the instructors, that oversee these classes and that is that. If it were a class that met normally I may not be asking for as much help, or have as many questions and as far as tutors, they work 9-5, well so do I, also not an option.
On top of it all this instructor has been with the school for years, and a few guys whining about a class probably isn't going to combat that well. I choose instead to take it upon myself, as adult, to use the internet as a learning tool rather than a toy.
Thank you once again, I appreciate your knowledge and any other information recieved in the future