473,326 Members | 2,655 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,326 software developers and data experts.

Variable initialisation

If you look at the following two pieces of code they perform exactly the
same task

Dim sMessage As String
sMessage = "Hello!"

Dim sMessage As String = "Hello!"

Is there any difference "behind the scenes" where one of the following is
preferable to the other, or is this just personal preference?


Jul 21 '05 #1
3 1154
or is this just personal preference?


Yep

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 21 '05 #2
Personnal preference (unlike VB6). You could look at the MSIL code to make
sure...

--

"JohnFol" <Ou************@WibbleObbble.Com> a écrit dans le message de
news:FB****************@newsfe3-win.ntli.net...
If you look at the following two pieces of code they perform exactly the
same task

Dim sMessage As String
sMessage = "Hello!"

Dim sMessage As String = "Hello!"

Is there any difference "behind the scenes" where one of the following is
preferable to the other, or is this just personal preference?

Jul 21 '05 #3
thanks for the answers

"JohnFol" <Ou************@WibbleObbble.Com> wrote in message
news:FB****************@newsfe3-win.ntli.net...
If you look at the following two pieces of code they perform exactly the
same task

Dim sMessage As String
sMessage = "Hello!"

Dim sMessage As String = "Hello!"

Is there any difference "behind the scenes" where one of the following is
preferable to the other, or is this just personal preference?

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim | last post by:
Please advise if you can. Presumably initialisation of members in member initialisation lists is perfomed by 'C' run-time startup. If the CRT was never started-up would those members be garbage?...
22
by: Gene Wirchenko | last post by:
Is the following guaranteed safe? void InitInt(int & SomeInt) { SomeInt=3; return; } int main() {
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
7
by: gyan | last post by:
follwing code gives error: 1 #include<iostream.h> 2 int main() 3 { 4 int a=5,b; 5 switch(a){ 6 case 1: 7 {b=5; 8 break; 9 }
13
by: Frederick Gotham | last post by:
I have just been reading 8.5 in the Standard, and am trying to make sense of the different kinds of initialisations. Up until now, I thought of an object as either NOT being initialised (i.e....
16
by: silversurfer2025 | last post by:
Hello everyone, once again, I have a very basic problem in C++, which I was not able to solve (maybe because of my Java-Experience or just because it is always the small syntax-things which break...
12
by: John Doe | last post by:
Let's say I had code like these, what is better? for(;;) { bool finished; do { } while (!finished);
10
by: n.torrey.pines | last post by:
Are global variables (and const's) guaranteed to be initialized before static class members (and methods) ? const int x = 19907; int get_x() { return x; } // another compilation unit: ...
14
by: subramanian100in | last post by:
Consider the following program: #include <iostream> using namespace std; int main() { int i;
14
by: Richard Heathfield | last post by:
In an otherwise excellent article, Eric Sosman said: <snip> ....or will read it without ever writing it, in which case the initialisation value protects you against reading an indeterminate...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.