Badie05
|
Visual Basic HelpI need help with my freaking code. It's a time conversion application. It's supposed to convert minutes to seconds and minutes to hour and seconds. The application uses Modulus Division and Integer Division.
| Code: |
Public Class Form1
Private Sub radHour_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles radHour.Click
Dim x As Decimal
Dim q As Decimal
Dim d As Decimal
x = (Me.txtMinutes.Text)
q = x / 25
d = x - q * 25 / 10
Me.lblTimeIs.Text = "The time in hour:minute format is"
Me.lblTimeIs.Text = x / 60
Me.lblTimeIs3.Text = x Mod 60
End Sub
Private Sub radSeconds_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles radSeconds.Click
Dim x As Decimal
x = (Me.txtMinutes.Text)
Me.lblTimeIs2.Text = "The time in seconds format is"
Me.lblTimeIs2.Text = x * 60
End Sub
Private Sub radHour_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radHour.TextChanged
Me.lblTimeIs.Text = ""
Me.lblTimeIs2.Text = ""
Me.lblTimeIs3.Text = ""
End Sub
End Class
|
|
Zaraki Kenpachi
|
did you ask DNG??since he alreay did excercises 7 and 9 while I'm doing them today and maybe Phatkav can help you since he learned about visual basic last semester.....
|
Badie05
|
I GOT IT
| Code: |
Public Class Form1
Private Sub btnCoins_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCoins.Click
Dim change As Integer
Dim Quaters As Integer
Dim Dimes As Integer
Dim Nickels As Integer
Dim Pennies As Integer
change = Val(Me.txtChange.Text) 'Display Answer
Quaters = change \ 25
Dimes = (change Mod 25) \ 10
Nickels = ((change Mod 25) Mod 10) \ 5
Pennies = (((change Mod 25) Mod 10) Mod 5) \ 1
Me.lblQuaters2.Text = Quaters
Me.lblPennies2.Text = Pennies
Me.lblNickels2.Text = Nickels
Me.lblDimes2.Text = Dimes
End Sub
End Class
|
|
Phatkav
|
LMAO
This is hilarious because I remember that we did the same exercise and my code as similar to the one Badie posted.
|
HungryHungryHippo
|
Visual basic....? isn't that a program that you draw pictures with?
|
Zaraki Kenpachi
|
not really pictures>..>it's all about functions of labels/buttons/....etc on a form and application and then you have to code them,to do some certain function...,(we learn these /in programming class....except we don't since our teacher is horrible at teaching us, in the class he says okay you guys are nerds....read the book and teach yourself:(.....so many are failing lol..)
|
bashmo
|
OMG badie i got that question in like 10 minutes done lol, youre so noob >.<
|
Zaraki Kenpachi
|
first Bashmo that wasn't an easy question>..>and you copied the code.......
|
Phatkav
|
That is an easy code if you know what you are doing.
|
Zaraki Kenpachi
|
come no you finished the course give us a break our teacher depends on us learning these ourselves>.<(he teaches us nothing!!..)
|
Phatkav
|
| Zaraki Kenpachi wrote: | | come no you finished the course give us a break our teacher depends on us learning these ourselves>.<(he teaches us nothing!!..) |
But still I don't remember having any difficulty with that certain assignment when we got it. Though my code had some messed up formula but it still worked.
|
|
|