Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 17974
Number of posts: 55343

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Need help with these Visual Basic questions Posted by darlene25 on 28 Nov 2012 at 11:14 AM
Direction: Determine the output displayed when the button is clicked

Problem Two:
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
‘Rule of 72
Dim p As Double
p = CDbl (txtPopGr.Text) ‘Population growth as a percent
txtOutput.Text = “The population will double in “ &
DoubleTime(p) & “ years."
End Sub
Function DoublingTime(ByVal x As Double) As Double
‘Number of cars that can be parked
Return 100 * x
End Function

Problem Three:
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim d As Date = #12/4/2011#
txtOutput.Text = MonthAbbr(d)
End Sub
Funcion MonthAbbr(ByVal d As Date) As String
Dim str As String = FormatDateTime(d, DateFormat.LongDate)
Dim n As Integer = str.IndexOf(“ “)
Return str.Substring(n + 1, 3)
End Function

Direction: Write a program that displays the output shown in a list box. The last two lines of the output should be displayed by one or more Sub procedures using data passed by variables from an event procedure.


Problem Three: Assume that the current date is 12/31/2010, the label for txtBox reads “What is your date of birth?”, and the user enters 2/3/1984 into txtBox before btnDisplay is clicked.
You are now 26 years old.
You have lived for 9824 days.





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.