visual basic. the close method the close method is used to close a form. to close a form use the...

24
Visual Basic

Upload: alvin-aron-richardson

Post on 18-Jan-2018

229 views

Category:

Documents


0 download

DESCRIPTION

Msgbox PromptText Icon Buttons Dialog title

TRANSCRIPT

Visual Basic The Close Method The Close method is used to close a form. To close a form use the keyword Me to refer to the form. Me.Close() Msgbox PromptText Icon Buttons Dialog title Msgbox -Parameters The message box function takes 3 main parameters: Msgbox (Prompt Text, Buttons+Icon, DialogTitle) [ Prompt is a string which contains the message. ] Button Constant vbOKOnly vbOkCancel vbYesNo vbYesNoCancel vbAbortRetryIgnore vbRetryCancel Icon ConstantIcon vbQuestion vbInformation vbExclamation vbCritical Msgbox -Example Dim Ans As String Ans = Msgbox("Are you sure?", vbYesNo+vbExclamation,- "Front Page Editor") OR Ans = MessageBox.Show("Are you sure", "FrontPage Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) InputBox InputBox: predefined dialog box that includes a prompt, a textbox, and an OK and Cancel buttons. It is used to get information from the user. Prompt: question or instruction for the user. Title: for InputBoxes, the text that appears in the blue bar at the top Input Box PromptText DefaultText DialogTitle Parameters: The input box function takes three main parameters: InputBox ( PromptText, DialogTitle, DefaultText) Example: Dim DocName As String DocName = InputBox ("Please enter the documents title", _ "Enter Title", "Document 1") Input Box Specific Example Dim strUserName As String strUserName = InputBox(What is your name?, Request Name) If the user enters no text, or presses the cancel button, then the InputBox function will return the value Nothing. You can check for this in your code: If strUserName = Nothing Then MessageBox.show(Cancelled) End Ifz If the user has entered some text into the textbox and pressed the OK button, then the text they entered is now saved in the variable strUserName. Input Box Space Function Used to add spaces to your string. Just call it and send to it the number of spaces you want. Example: Dim Str1 as String = Hello & Space(5) & , You just add 5 spaces MsgBox(Str1) Progress bar Progress bars are used to display the progress of your application or background tasks. There are three members of the ProgressBar control you should know about: the Maximum, the Minimum, and the Value properties. Status Bar Status Bars are used to display status messages at the bottom of the form. They are generally used to provide additional information, such as page numbers, display a message, etc. Random Numbers -Declaration Dim randomNumber As Random = New Random Variable nameData typeInitialization Random Numbers -Methods Next() Non-negative random integer NextDouble() A double between 0.0 and 1.0 Next(IntegerValue) A positive integer < IntegerValue Next(IntValue1,IntValue2) IntValue1