SlideServe
Menu
Préférences
© SlideServe · v2026

Mastering Message and Input Boxes in Visual Basic

tab avatar
11 diapositives · 259 Views · Sep 01, 2014

In this lecture, you will learn how to effectively create and utilize message boxes and input boxes in Visual Basic programming. Discover the functionalities of the MessageBox class, which allows for user communication through standard dialog boxes, displaying custom messages, captions, icons, and button options. You'll explore the syntax and examples of the MessageBox.Show method, learn to retrieve user input using the InputBox method, and understand how to set default values and position your input boxes on the screen. Enhance your application interfaces with these essential control structures.

Mastering Message and Input Boxes in Visual Basic - slide 1
01 / 11Mastering Message and Input Boxes in Visual Basic
1 / 17

Télécharger la présentation

Mastering Message and Input Boxes in Visual Basic
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Lecture Set 5 Control Structures Part B -Message and Input Boxes

  2. Objectives • Learn how to create and use to your advantage message boxes and input boxes

  3. The MessageBox Class • The MessageBox is a standard dialog box that displays • A message • A caption • An icon • One or more standard button groups • This is extremely handy for software-user communication and for debugging purposes

  4. The MessageBox Show Method (Syntax) • Public Shared Function Show( _ ByVal text As String, _ ByVal caption As String, _ ByVal buttons As MessageBoxButtons, _ ByVal icon As MessageBoxIcon) _ As DialogResult • text appears in the title bar • caption contains the message • buttons defines the button(s) • icon defines the icon

  5. The MessageBox.Show Method (Example) • Display a message box with Yes and No buttons Dim Result As DialogResult Result = MessageBox.Show( _ "Do you want to quit?", "Exit", _ MessageBoxButtons.YesNo, _ MessageBoxIcon.Question) If Result = DialogResult.Yes Then Me.Close() End If

  6. Message Box

  7. Message Box Enumerations

  8. The InputBox(Introduction -Optional) • The InputBox gets a text string from the end user • It's a standard dialog box • It is possible to supply a default textual value

  9. The InputBox(Syntax - optional) • Shared Function InputBox _ (ByVal prompt As String, _ Optional ByVal title As String, _ Optional ByVal defaultResponse As String, _ Optional ByVal xPos As Integer, _ Optional ByVal yPos As Integer) _ As String • prompt contains a descriptive prompt • title appears on the title bar • defaultResponse contains the default value • xPos and YPos contain the coordinate values where the input box will appear

  10. The InputBox(Example - optional) • Display an input box and store the returned string in ResultString • Declares a string variable to store a string entered by the user and returned by the InputBox method Dim ResultString As String ResultString = _ Microsoft.VisualBasic.InputBox( _ "Enter a value", "Title", _ "Default Value", 0, 0)

  11. Input Box (optional)