Visual Studio.net Programming Languages / Arithmetic Operations
Subtitles of the Movie
We can also use operators to work with strings. Let's go back to our form and copy and paste the button one more time and let's stretch it out just a little bit, we're going to make it concatenate, I hope I spelled that correctly, sure enough, Okay, double click that button copy and paste the code, this time since we are working with strings, we're going to have to change the data type. We don't have to change the default value, now the default value will simply be interpreted as a string, a and b are still pulling the values from TextBox1.text and TextBox2.text, Label2.text is still going to be where the answer ends up, and now, we're going to concatenate the two strings. Those two concatenation operators the ampersand and the plus sign. Let's start by using the ampersand, if you're concatenating strings you can use either one of these operators, but it is best to use the ampersand because then there's no ambiguity about what's happening, you are going to join two strings together. Let's run this and see how it works for us. If we concatenate zero and zero, we should end up with zero zero, not zero, which you will get if you added numeric value zero together and sure enough we get zero zero. We can concatenate Dave and Mercer, and sure enough notice it kept the space as well, I put a space, you can't see it but I put the space right in there, but it kept the space.
Tutorial Information
| Course: | Microsoft Visual Studio .NET |
| Author: | Dave Mercer |
| SKU: | 33420 |
| ISBN: | 1932072276 |
| Release Date: | 2003-04-01 |
| Duration: | 7 hrs / 101 lessons |
| Work Files: |
Yes |
| Captions: | For Online University members only |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 