If then else - control statement, Visual Basic Programming

Assignment Help:

If Then Else:

The control statement If Then Else is used for computing a condition and taking the action based on the condition. If the condition is true then the section will execute or else block will execute.

If .. Then...Else:

If condition Then

Block of VB Statements

Else

Block of VB Statements

End If

To use If then Else construct you can place a button and the text box on the form as given in the figure. Now Run the project and enter the value in the text box and then click the button. The event handler given below executes and if the value entered surpasses 50 it displays passes, or else it displays fail.

Private Sub Command1_Click()

If Val(Text1.Text) > 50 Then

Form1.Print "pass"

Else

Form1.Print "fail"

End If

End Sub

2370_if then else.png

Figure: Illustration of If then Else


Related Discussions:- If then else - control statement

Change calculator, how do i create a change calculator that gives the denom...

how do i create a change calculator that gives the denominations of coins for an amount of change up to .99 cents

XML document, Write a XML with database with book details (BOOK ID, Title, ...

Write a XML with database with book details (BOOK ID, Title, Author, subject, published Year, language, vendor, price)

Validation controls, Describe different validation controls of VB.net?

Describe different validation controls of VB.net?

#title., Write a program to print a digital clock which displays the time f...

Write a program to print a digital clock which displays the time for 2 hours . ..

Sum of numbers Calculator with Tryparse, I need assistance with writing the...

I need assistance with writing the Tryparse I have 98% of the assignment done.

XML with database, write a XML with database with book details( book id, au...

write a XML with database with book details( book id, author ,subject, published year, vendor,price, language )

Dialog based application - types of project using visual c++, Dialog Based ...

Dialog Based Application: The application which app wizard generates is based on the dialog template resource.

Match Game, I would like someone to look at my code and tell me why it''s n...

I would like someone to look at my code and tell me why it''s not working

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd