![]() The software creators 3.45k subscribers the very basic use of if then else statements used in visual basic 2010. i've tried: if = 1 then year( getdate() ) 1 else year( getdate() ) endif i've tried searching, but can't find any assistance on using the expression builder. i just can't figure out how to use if statements in the expression builder. Now i need to set year to be current year unless = 1, then be current year 1. vb sub fixdate () mydate = #2 13 95# if mydate < now then mydate = now end sub to run more than one line of code, you must use the multiple line syntax. ![]() ![]() the following example shows the single line syntax, omitting the else keyword. To run only one statement when a condition is true, use the single line syntax of the if then else statement. If condition then visual basic 2010 expression else visual basic 2010 expression end if example 9.2: using if then else private sub button1 click (byval sender as system.object, byval e as system.eventargs) handles button1.click dim mynumber as integer mynumber = textbox1.text if mynumber > 100 then label2.text = " congratulation!. ![]() Simple If Then Else Statements Di Visual Basic Studio 2010 Pemula Part 2Įlseif count = 1 then message = "there is 1 item." 'if count is greater than 1, output will be "there are items." end if console.writeline (message) end sub end module 'this example displays output like the following: ' there are 4 items.
0 Comments
Leave a Reply. |