Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vb.net syntax question

Posted on 2016-07-20
6
Medium Priority
?
94 Views
Last Modified: 2016-08-09
I ran into the following line of code in a project:
Dim X As System.Xml.XmlDocument : X = New System.Xml.XmlDocument()

what is the ":" being used for here?
0
Comment
Question by:dhenderson12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 9

Expert Comment

by:Trideep Patel
ID: 41721050
":" is used to write two statements in one line.
Like below

Dim i As Integer : Dim j As Integer : Dim k As Integer

Here once can write three separate lines
Dim i As Integer
Dim j As Integer
Dim k As Integer
0
 
LVL 27

Accepted Solution

by:
Shaun Kline earned 2000 total points
ID: 41721053
The colon acts like a statement separator.
The code could be rewritten like below and produce the same effect:
Dim X As System.Xml.XmlDocument
X = New System.Xml.XmlDocument()

Open in new window

0
 

Author Comment

by:dhenderson12
ID: 41723040
thanks, guys.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 41725964
Personally, I just combine all of that into one statement--no colon needed:

Dim X As New System.Xml.XmlDocument()

Anything else is just a waste of keystrokes.
0
 

Author Comment

by:dhenderson12
ID: 41735108
sorry for the delay
0
 

Author Comment

by:dhenderson12
ID: 41747495
thanks
0

Featured Post

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question