Sunteți pe pagina 1din 2

the various syntax used are:msgbox() : used to display dim :- used to define a variable new :- keyword to create a replica

of a succeeding form name and saving it in a variable. hide() :- to hide the current form show() :- to show the current form examples:1) Msgbox ( "welcome") # this will display the message "welcome" 2) Dim x As Integer # this will define a variable 'x' as an integer 3) Dim a As New form2 () a.show() me.hide() #this will create a copy of form2 and will store it in 'a' # a.show() command will show the the value of 'a' i.e. the form2 # me.hide() command will hide the current form 4) Dim a As string a= Textbox1.Text Msgbox(" Thanku Mr. " +a) Textbox1.Text="" # a is defined as a string variable #the value entered in textbox1 in the form (layout view) is stored in a #msgbox will display the value of 'a' after the msg in the quotes #the value of Textbox1 will again become "" i.e. empty (so tht new value can be entered next time) code to check whether username and password are correct:-

double click on the button in the form (layout view) this will open a program code.. private sub Button_click ................ sumthng.... Dim x,y,z As String x= Textbox1.Text y= Textbox2.Text z=x+ " " +y If Textbox1.Text ="admin" and Textbox2.Text= "NIFT" Then msgbox("welcome to my application; ur id and password are: " +z) else msgbox("invalid Id and Password") End If # x and y are storing the values in textbox1 (i.e. username in the form) and textbox2 (i.e. password in the form) respectively #z is adding the 2 strings with a space in b/w # if statement is checking whether the id and password are as mentioned (the above program code is for single user, and will work only for id=admin and password = NIFT) P.S. : to make password look like password (i.e. ****), go to 'behaviour' in the properties window n change the password character to * ) thnx n regards prerna....:)

S-ar putea să vă placă și