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

Using $ in some commands

Hi,

I have a lot of old VB 6 experience and for the last several years
have been programming in C#. Now I'm going to be doing some VB.NET
development. As I'm "relearning" things so to speak, I remember I was
taught that using commands like Trim$ and LTrim$ instead of Trim and
LTrim were the better way to go (although I cannot remember why).

Does this still hold true in VB.NET?

Jan 31 '07 #1
5 1248
nope, there are .net oriented methods in the string class now to use
instead... if it worked in C# it will work in VB.NET basically
"Doogie" <dn******@dtgnet.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
Hi,

I have a lot of old VB 6 experience and for the last several years
have been programming in C#. Now I'm going to be doing some VB.NET
development. As I'm "relearning" things so to speak, I remember I was
taught that using commands like Trim$ and LTrim$ instead of Trim and
LTrim were the better way to go (although I cannot remember why).

Does this still hold true in VB.NET?

Jan 31 '07 #2
Doogie wrote:
I remember I was
taught that using commands like Trim$ and LTrim$ instead of Trim and
LTrim were the better way to go (although I cannot remember why).

Does this still hold true in VB.NET?
No.

The reason Trim$() was preferable to Trim() was because they were both
different functions. Trim$() returned a String, Trim() returned a Variant
which was then implicitly converted to a string in your code. The Variant
approach used additional resources and was slower to execute.

In VB.NET they have tidied all of this up now, and there is a single
function called Trim() which returns a String. There's no equivalent to the
Variant-returning version of the function from VB6. If you follow the
function call with the $ suffix, this will be tolerated but ignored.

Hope that helps,

--

(O)enone

Jan 31 '07 #3
Good to know. Thanks to both of you!
Jan 31 '07 #4
Doogie wrote:
I remember I was taught that using commands like Trim$ and LTrim$
instead of Trim and LTrim were the better way to go (although I
cannot remember why).
Trim$ returned a String.
Trim returned a Variant /containing/ a String.

There were some performance benefits in /avoiding/ the Variant "wrapper".
Does this still hold true in VB.NET?
Nope! All the String functions now return Strings and Variants are Dead
and Buried.

HTH,
Phill W.
Jan 31 '07 #5
"Smokey Grindle" <no****@dontspamme.comschrieb:
nope, there are .net oriented methods in the string class now to use
instead...
There is no reason to use the 'String' class' methods instead of the
'Strings' module's functions. These functions are still fist class citizens
in VB!

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

Jan 31 '07 #6

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

Similar topics

1
by: Junior | last post by:
I keep receiving this "The type or namespace name 'CASsEventHandler' could not be found (are you missing a using directive or an assembly reference?)" message in two particular lines, and I've...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
2
by: Paul Reddin | last post by:
Hi, (V8.1 Fp2) Our application uses JDBC batch to execute mutiple insert statements and we saw a strange thing this morning. There were 4 SQL Insert statements in the batch, and we know the...
21
by: The Man With The Harmonica | last post by:
Hi All, What kind of commands can I use to control the serial and parallel port of my pc. I want to use my laptop instead of microcontrollers and write my software in ANSI C to be used for...
9
by: kapsi | last post by:
Hey all, I was just wondering as to how to implement dos commands and windows commands using the C language? any ideas?
16
by: John Salerno | last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of...
5
by: Johannes Röckert | last post by:
Hi, can anyone help me on how to develop a program in c++ which does single step execution using a callback between the asm commands? I need something like debuggers do - a callback function...
11
by: chsalvia | last post by:
I've been programming in C++ for a little over 2 years, and I still find myself wondering when I should use polymorphism. Some people claim that polymorphism is such an integral part of C++,...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
3
by: gisto moss | last post by:
i have to implement the shell such that it accepts commands, together with parameters. Assume all possible commands have either 0 or 1 parameter. I need to check this. if(commandstrings.length>2)...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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,...
0
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...

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.