It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Are you a VB pro? Help a beginner!

Moderator: dafunkymunky

Are you a VB pro? Help a beginner!

Postby VBNimrod on Mon Mar 21, 2011 1:27 am

Hello DEVPPL,
I'm working on an exercise called "Long-Distance Calls," which asks me to let the user choose a phone rate between three radio buttons and multiply it by the amount of minutes (inputted into a textbox). The result should appear in another textbox.

It also asks me to include error checking in the following ways: the minutes input by the user must be numeric, and it must be greater than zero.

I've created the three radio buttons with their respective labels along with the input textbox (minutes) and the output textbox (charges).
Regarding the code, this is what I've come up with up till this point:

'Take the user-input
Dim intNumber As Integer ' Number of minutes
Dim dblRatePerMinute As Double ' Rate Per Minute
Dim textCharges As Double ' Charges

'Check the number of minutes.
If Integer.TryParse(textNumber.Text, intNumber) Then

End If

'Take the newly converted integer and multiply it by the selected radio button..
If radDaytime.Checked = True Then
dblRatePerMinute = 0.07
ElseIf radEvening.Checked = True Then
dblRatePerMinute = 0.12
ElseIf radOffPeak.Checked = True Then
dblRatePerMinute = 0.05

textCharges = CDbl(textNumber.Text) * dblRatePerMinute
Else

'Display an error message.
MessageBox.Show("The input must be numeric")

End If

_________________

I know this is probably very wrong! Sorry but I'm a complete amateur! Whatever help you can give me will be appreciated. Thank you for your time!
VBNimrod
 
Posts: 1
Joined: Mon Mar 21, 2011 1:23 am

Who is online

Users browsing this forum: No registered users and 3 guests