Answer» Hi I have this batch file code:
@echo off :MAIN set password=bibo echo Welcome to SMARTIA. Please enter the password. set /p input=Password: if %input%==%password% start Psp.exe
when I RUN it, it gives me what I want but in the DOS poor interface. Can VB6 do the same task with its good interface? and can I add an ELSE statement to write (Sorry, incorrect password). If possible please SHOW me the way
thanks I don't KNOW any VB6 so I did it in Visual Basic .NET in Visual Studio. I hope you (or someone else) can translate it to VB6. =)
Here is the code:
Code: [Select]Public Class Smartia
Dim password As String = "bibo"
Public Sub New() ' This call is required by the Windows Form Designer. InitializeComponent()
' Add any INITIALIZATION after the InitializeComponent() call. lblWelcome.Text = "Welcome to SMARTIA. Please enter the password." End Sub
Private Sub txtpw_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtpw.KeyDown If Not e.KeyCode = Keys.Enter Then Return End If If txtpw.Text = password Then lblSorry.Text = "" txtpw.Text = "" Dim RetVal As Object = Shell("C:\WINDOWS\System32\calc.exe", 1) Else lblSorry.Text = "Sorry. Wrong password" End If End Sub End Class
Screenshot: screenshot 1 screenshot 2
Treval
|