Visual Basic Help!!!!!

Orga Smic

Registered User
Joined
Jan 1, 2014
Messages
364
Age
55
I have an assignment that is due in the next couple of hours. Is there anyone on here that knows visual basic that can help?
I am given a program and have to find the errors. I know it is a long shot but I really need to finish this.

Please message me and I can send the Word Doc I created to show the code. Or I could send the whole program to you. It is not a very big one, 197KB.
 
Perhaps if you had sent this over yesterday or something lol. No time for you now. Got some code to do and go to work. VB is easy :p
 
Public Class frmQuiz

Dim numCorrect As Integer

Private Sub btnTakeQuiz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTakeQuiz.Click
numCorrect = 0
GiveTest(1)
GiveTest(2)
GiveTest(3)
GiveTest(4)
GiveTest(5)
GiveTest(6)
GiveTest(7)
ShowMessage()
End Sub

Sub GiveTest(ByVal numProverb As Integer)
Dim numSaying As Integer
Dim saying As String = ""
Dim answer As String = ""
Dim reply, question As String


GetProverb(numSaying, saying, answer)
question = "(" & numProverb & ") " & saying & " (T/F)"
reply = InputBox(question)
If reply.ToUpper = answer Then
MessageBox.Show("You're right.", "Question " & numProverb)
numCorrect += 1
Else
MessageBox.Show("I'm sorry. You're wrong.", "Question " & numProverb)
End If
End Sub

Sub GetProverb(ByVal which As Integer, ByRef proverb As String,
ByRef truthVal As String)
Select Case which
Case (1)
proverb = InputBox("The squeaky wheel gets the grease.")
truthVal = "T"
Case 2
proverb = "Cry and you cry alone."
truthVal = "T"
Case 3
proverb = "Opposites attract."
truthVal = "F"
Case 4
proverb = "Spare the rod and spoil the child."
truthVal = "F"
Case 5
proverb = "Actions speak louder than words."
truthVal = "T"
Case 6
proverb = "Familiarity breeds contempt."
truthVal = "F"
Case 7
proverb = "Marry in haste, repent at leisure."
truthVal = "T"
End Select
End Sub

Sub ShowMessage()

Select Case numCorrect
Case 7
MessageBox.Show("Perfect. " & numCorrect & " correct")
Case 5, 6
MessageBox.Show("Excellent. " & numCorrect & " correct")
Case Else
MessageBox.Show("You might consider taking Psychology 101. " &
numCorrect & " correct")
End Select
End Sub

End Class
 
I have to locate all the problems and then correct them. I have been struggling with this class.
 
Are you sure all of your problems are in the main source? If your source references a visual component by the wrong name or tries to pass a parameter wrong your only going to notice by running the program as well as checking the form and its components in the IDE.

I don't see anything at a glance but running the program (and having the full project) is going to tell you alot more alot faster than just looking at the source. I haven't touched a vb IDE in a decade but if your not getting the output you expect from your input you should be able to create break points in the code, run it and step through each step examining the current value of a variable to see where things are going wrong.
 
Are you sure all of your problems are in the main source? If your source references a visual component by the wrong name or tries to pass a parameter wrong your only going to notice by running the program as well as checking the form and its components in the IDE.

I don't see anything at a glance but running the program (and having the full project) is going to tell you alot more alot faster than just looking at the source. I haven't touched a vb IDE in a decade but if your not getting the output you expect from your input you should be able to create break points in the code, run it and step through each step examining the current value of a variable to see where things are going wrong.

That's what I'm saying.
 
This is a program given to me, it has issues on purpose. I have to find the issues and make it work. It is a class that I have struggled alittle with and am having issues noticing the problem. I am looking for help to fix it. Thank you.
 
You have only posted half the source. That's what the .bas file or whatever they use these days. Where's the form markup file.

How do I know that the button has be assigned to the onclick action of btnTakeQuiz_Click without the entire project? Just because it has the name of the button and the action in the subroutine doesn't mean its assigned anymore. For all you know that's one of your issues.

The logic looks okay on paper but you debug a program by running it not just looking at the source code blindly.

From what I see we have half the equation. I don't know for sure without testing it if there is an issue in the main source or the rest of the project.

Is that all they gave you? Sure we can follow the logic on paper. But its not how a programmer would solve this problem in the real world. If they gave you the real VB project that would be a better place to start. If they didn't then it makes it harder and means they aren't looking at problems that occur elsewhere.

Sent from my Nexus 5 using Tapatalk
 
How do I know that the button has be assigned to the onclick action of btnTakeQuiz_Click without the entire project? Just because it has the name of the button and the action in the subroutine doesn't mean its assigned anymore. For all you know that's one of your issues.

There's no issue if it has buttons.
I'll push it!
Push the button!
 
Sadly I wish I had seen this earlier. More time in advance would have been helpful :)
 
i see 4 error with out an editor. why get someone to do your home work?
 
Back
Top