VB.Net Tutorial/GUI/InputBox

Материал из VB Эксперт
Перейти к: навигация, поиск

Get input from InputBox

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class PasswordFieldMatch
   public Shared Sub Main
      Dim Filename As String
      Filename = InputBox("Your Value", "Title", "c:\document")
   End Sub
End class

InputBox Demo

public class InputBoxDemo
   public Shared Sub Main
        Dim PASSWORD As String
        PASSWORD = InputBox("Password", "Password Dialog")
        Do While PASSWORD <> "12345"
            PASSWORD = InputBox("Password", "Password Dialog")
        Loop
   End Sub
End class

Read Integer value from Keyboard

Module Module1
    Sub Main()
        Dim Age As Integer
        Console.Write("Age: ")
        Age = Console.ReadLine()
        Console.WriteLine(Age)
    End Sub
End Module
Age: 12
12

Use InputBox to read Double value

Module Module1
    Sub Main()
        Dim Salary As Double
        Salary = InputBox("Enter salary")
        Console.WriteLine(Salary)
    End Sub
End Module

Use InputBox to read Integer value

Module Module1
    Sub Main()
        Dim Age As Integer
        Age = InputBox("Enter age", 21)
        Console.WriteLine(Age)
    End Sub
End Module

Use InputBox to read string value

Module Module1
    Sub Main()
        Dim Name As String
        Name = InputBox("Enter name")
        Console.WriteLine(Name)
    End Sub
End Module
asdf