473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Usage of colon (i.e. : ) for multiple statements?

36
When using : in VB.NET, will the order of events ALWAYS follow the order I've coded it in?

Such as:
Expand|Select|Wrap|Line Numbers
  1. Private Sub DoSomething(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles dvCertTypes.ListChanged, dvJobTypes.ListChanged
  2.         Dim _flw As FlowLayoutPanel
  3.  
  4.     If Equals(sender, dvCertTypes) Then _flw = flwCertTypes Else _
  5.             If Equals(sender, dvJobTypes) Then _flw = flwJobDesc Else _
  6.                 If Equals(sender, "both") Then LoadCertSelections(dvCertTypes, Nothing) : LoadCertSelections(dvJobTypes, Nothing) : Exit Sub
  7.  
  8.     Do more stuff...
  9. End Sub
  10.  
Jul 27 '10 #1

✓ answered by Joseph Martell

Basically yes, the order of execution should be effectively the same as written. Each statement separated by a : is treated as a separate statement and is subject to the same rules as statements on separate lines.

Technically, there is no guarantee that statements are executed in exactly the same order as written in source. Remember that your source written in a .Net language goes through several compilations and optimizations before you end up with executable code.

What you can guarantee is your sub will not be exited before valid preceeding statements are executed. In your example
Expand|Select|Wrap|Line Numbers
  1. LoadCertSelections(dvJobTypes, Nothing)
will get executed before you exit your sub (assuming preceeding conditions are met).

1 3659
Joseph Martell
198 Expert 128KB
Basically yes, the order of execution should be effectively the same as written. Each statement separated by a : is treated as a separate statement and is subject to the same rules as statements on separate lines.

Technically, there is no guarantee that statements are executed in exactly the same order as written in source. Remember that your source written in a .Net language goes through several compilations and optimizations before you end up with executable code.

What you can guarantee is your sub will not be exited before valid preceeding statements are executed. In your example
Expand|Select|Wrap|Line Numbers
  1. LoadCertSelections(dvJobTypes, Nothing)
will get executed before you exit your sub (assuming preceeding conditions are met).
Jul 27 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Shmuel | last post by:
Is it possible to query multiple statements at once? Like: $query = "set @p := 1; select @p + 1"; $results = mysql_query($query); I'm thinking of PHP4. There is in mysqli the prepare...
2
by: Richard Adams | last post by:
Is it possible to execute more than one statement in SQL via MDAC ODBC? I have a fairly complex select I wanted to create a view with, but trying to send it all as one string with terminators ';'...
1
by: Erik Haugen | last post by:
This item in the C++ faq: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-38.5 discusses macros with multiple statements. The problem is that a macro such as #define...
4
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
2
by: Nabil | last post by:
I am new to DB2 and here is my situation. I have 2 temp tables where I am trying to insert data (from 2 select statements) DECLARE v_t1 VARCHAR(50); DECLARE v_t1 VARCHAR(50); DECLARE stmt1...
2
by: Annie D via AccessMonster.com | last post by:
Hi, Is it possible to use multiple statements in SQL?? (I’ve never used it before) : I have one query that i'm working with, The statements I want to use are as below, they all work...
1
by: arthy | last post by:
Hi, Is it possible to execute multiple statements on to the database using a single dbconnection object.what is the drawback in using .If not possible ,then how can the execution of multiple...
7
by: paladin.rithe | last post by:
I have 2 statements that I'd like to string together in a query, but according to everything I'm seeing, it's not possible. What I'm doing is an insert of a row, where the primary key is an auto...
6
by: jodleren | last post by:
another topic though related to the previous post. How do IF behave in php? Say, if( $goahead && copy($somefile1, $somefile2) ) echo "hello world"; What if $goahead is false, will the if...
0
by: harsha318 | last post by:
Hi I need to have a single query and which can have multiple statements For eg: string str = string.Empty; str = "select * from Customers;Select * from Orders"; iDB2Connection iDB2con =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.