473,729 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB-101 Using "&=" operator

When displaying output in a MessageBox, using a variable Output as string,
the &= operator is used instead of the = operator. In which cases is the &=
operator used?
Nov 21 '05 #1
8 1522
"John Pass" <Jo******@discu ssions.microsof t.com> schrieb:
When displaying output in a MessageBox, using a variable Output as string,
the &= operator is used instead of the = operator. In which cases is the
&=
operator used?


'&=' is a shortcut operator:

\\\
s = s & "Foo"
///

is semantically equivalent to

\\\
s &= "Foo"
///

Note that some other shortcut operators like '+=', '*=', etc. exist too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Thanks for your reply Herfried,

I had used the other but not yet this shortcut operator &=.
I now also see that it is used to incorporate the old output into the new
output, since it otherwise would have gone lost. So it makes sense to use the
shortcut operator &= here.

Regards,

"Herfried K. Wagner [MVP]" wrote:
"John Pass" <Jo******@discu ssions.microsof t.com> schrieb:
When displaying output in a MessageBox, using a variable Output as string,
the &= operator is used instead of the = operator. In which cases is the
&=
operator used?


'&=' is a shortcut operator:

\\\
s = s & "Foo"
///

is semantically equivalent to

\\\
s &= "Foo"
///

Note that some other shortcut operators like '+=', '*=', etc. exist too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
All these simple 'operator' questions are in you built in MSDN Documentation

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #4
"Crouchie19 98" <cr**********@s pamcop.net> schrieb:
All these simple 'operator' questions are in you built in MSDN
Documentation


ACK. Simply place the caret over the '&=' in the IDE's text-editor and
press the F1 key :-). That's much easier than opening up the news client
and typing a question, waiting for the replies, ...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
I used to use that method in the old VB 6 days because it was quicker to
highlight what you needed to find then type it in But with the above method,
Herfried you may get the 'text under the cursor isn't recognised', error.

Another way is to highlight it & click on the dynamic help. Normally if its
listed it will be at the top of the list.

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #6
Crouchie,

"Crouchie19 98" <cr**********@s pamcop.net> schrieb:
I used to use that method in the old VB 6 days because it was quicker to
highlight what you needed to find then type it in But with the above
method,
Herfried you may get the 'text under the cursor isn't recognised', error.
For operators, it seems to work, but I agree that it doesn't work under all
circumstances.
Another way is to highlight it & click on the dynamic help. Normally if
its
listed it will be at the top of the list.


ACK. There are so many ways, but posting to the group is one of the most
complicated ones.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7
Excuse my ignorance, Herfried, but what does ACK mean?

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #8
"Crouchie19 98" <cr**********@s pamcop.net> schrieb:
Excuse my ignorance, Herfried, but what does ACK mean?


ACK = acknowledged :-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #9

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

Similar topics

8
2615
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical) stuff. The class will behave like a std::vector (copy constructor and assignment create a deep copy), but with 2D indexing. Now I also need a 'view' class that will behave like a reference to an 'image' (can only be constructed from an existing...
17
3320
by: Andreas Huber | last post by:
What follows is a discussion of my experience with .NET generics & the ..NET framework (as implemented in the Visual Studio 2005 Beta 1), which leads to questions as to why certain things are the way they are. ***** Summary & Questions ***** In a nutshell, the current .NET generics & .NET framework make it sometimes difficult or even impossible to write truly generic code. For example, it seems to be impossible to write a truly generic
16
1323
by: Boni | last post by:
Dear all, Is there any perfomance difference in string concatination using "+" vs "&"? I think, that compiler produces the same code for both. Am I right? Thank you, Boni
3
1933
by: david | last post by:
I do not how to include char & in a string. In C, use \&. But I do not know how in VB.NET? any one give me hand? I have the following error message. David ...... Syntax error: Missing operand after ''&''prot='' operator. Description: An unhandled exception occurred during the execution of the
12
1253
by: Domac | last post by:
What is the difference between "+" and "&" operator when joining strings? Thanx!
39
4722
by: dancer | last post by:
Can somebody tell me why I get this message with the following code? Compiler Error Message: BC30452: Operator '&' is not defined for types 'String' and 'System.Web.UI.WebControls.TextBox'. <html> <head> <% @Import Namespace="System.Web.Mail" %>
5
2857
by: joso | last post by:
public static bool isodd(int i) { return ((i & 1) == 1); } can someone explain me how this is working
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.