473,882 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Equivalent of VB6 Left

In VB6 I used to use the Left and Right functions a lot. e.g. strString =
Left(txtTexbox1 .Text, 20). In VB.NET I know I can prefix those functions
with
Microsoft.Visua lBasic.Left but I suspect there is a .NET method to
accomplish this?

Wayne
Nov 21 '05 #1
9 20051
Strings.Left()
Strings.Right()

hth greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"Wayne Wengert" <wa***********@ wengert.org> schreef in bericht
news:#z******** ******@TK2MSFTN GP09.phx.gbl...
In VB6 I used to use the Left and Right functions a lot. e.g. strString =
Left(txtTexbox1 .Text, 20). In VB.NET I know I can prefix those functions
with
Microsoft.Visua lBasic.Left but I suspect there is a .NET method to
accomplish this?

Wayne

Nov 21 '05 #2
"Wayne Wengert" <wa***********@ wengert.org> schrieb
In VB6 I used to use the Left and Right functions a lot. e.g.
strString = Left(txtTexbox1 .Text, 20). In VB.NET I know I can prefix
those functions with
Microsoft.Visua lBasic.Left but I suspect there is a .NET method to
accomplish this?

Left: txtTextbox1.tex t.substring(0, 20)
Right: no framework method available. Calculate Startindex and Length
arguments on your own (you can put it in your own function).

Be aware that Left also works if the string is shorter than the number of
characters to be retrieved. Substring would throw an exception in this case.
Armin

Nov 21 '05 #3
Peter,

"Peter Proost" <pp*****@nospam .hotmail.com> schrieb:
Strings.Left()
Strings.Right()


.... these methods are the methods mentioned by the OP
('Microsoft.Vis ualBasic.String s.{Left, Right}'). However, as you show it's
necessary to qualify them in Windows Forms forms, for example, to prevent a
name clash from occuring.

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

Nov 21 '05 #4
Thanks for the responses guys.

Wayne

"Wayne Wengert" <wa***********@ wengert.org> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
In VB6 I used to use the Left and Right functions a lot. e.g. strString =
Left(txtTexbox1 .Text, 20). In VB.NET I know I can prefix those functions
with
Microsoft.Visua lBasic.Left but I suspect there is a .NET method to
accomplish this?

Wayne

Nov 21 '05 #5
I thought so but I wasn't sure, I just wanted to look smart the last day
before my holiday :-)

But I was just wondering, is it better not to use them, or doesn't it
matter?

Greetz Peter
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> schreef in bericht
news:#x******** ******@TK2MSFTN GP12.phx.gbl...
Peter,

"Peter Proost" <pp*****@nospam .hotmail.com> schrieb:
Strings.Left()
Strings.Right()
... these methods are the methods mentioned by the OP
('Microsoft.Vis ualBasic.String s.{Left, Right}'). However, as you show

it's necessary to qualify them in Windows Forms forms, for example, to prevent a name clash from occuring.

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

Nov 21 '05 #6
Peter,

"Peter Proost" <pp*****@nospam .hotmail.com> schrieb:
But I was just wondering, is it better not to use them, or doesn't it
matter?


I use them, but some .NET puritans won't use them ;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #7
Wayne,
As Herfried suggests you need to qualify them when you use them on a Windows
form, as Form.Left hides the version from Microsoft.Visua lBasic.Strings.

What I normally do is use an import alias (in my forms & other types):

Imports VB = Microsoft.Visua lBasic

strString = VB.Left(txtText box1.Text, 20)

Hope this helps
Jay

"Wayne Wengert" <wa***********@ wengert.org> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
| In VB6 I used to use the Left and Right functions a lot. e.g. strString =
| Left(txtTexbox1 .Text, 20). In VB.NET I know I can prefix those functions
| with
| Microsoft.Visua lBasic.Left but I suspect there is a .NET method to
| accomplish this?
|
|
|
| Wayne
|
|
Nov 21 '05 #8
> What I normally do is use an import alias (in my forms & other types):

Imports VB = Microsoft.Visua lBasic

strString = VB.Left(txtText box1.Text, 20)


Cool! I did NOT know that! (Johnny Carson voice). You learn something new
every day around here :)
Nov 21 '05 #9
Jay;

Thanks for that tip.

Wayne

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:O$******** ******@tk2msftn gp13.phx.gbl...
Wayne,
As Herfried suggests you need to qualify them when you use them on a
Windows
form, as Form.Left hides the version from Microsoft.Visua lBasic.Strings.

What I normally do is use an import alias (in my forms & other types):

Imports VB = Microsoft.Visua lBasic

strString = VB.Left(txtText box1.Text, 20)

Hope this helps
Jay

"Wayne Wengert" <wa***********@ wengert.org> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
| In VB6 I used to use the Left and Right functions a lot. e.g. strString
=
| Left(txtTexbox1 .Text, 20). In VB.NET I know I can prefix those functions
| with
| Microsoft.Visua lBasic.Left but I suspect there is a .NET method to
| accomplish this?
|
|
|
| Wayne
|
|

Nov 21 '05 #10

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

Similar topics

2
3284
by: Michael Foord | last post by:
Please pardon my ignorance on this one - but I'm not certain how the sign bt is treated in python bitwise operators. I've trying to convert a javascript DES encryption routine into python. Javascritp has >>> and >>. >>> is a zero fill bit shift whereas >> is a sign propagating bit shift. My understanding is that the python >> is equivalent to the javascript >> - but python has no equivalent to >>>. Would a >>> 3 in javascript be...
1
5670
by: JBBHF | last post by:
Hi i'm working on a web project, and i would like to make my oracle query work in mysql. select match.numero "nummatch", to_char(match.datematch, 'yyyy-MM-dd') "datematch", p1.numjoueur "j1", p2.numjoueur "j2", po1.p1 "m1p1", po1.p2 "m1p2", po2.p1 "m2p1",
27
6713
by: junky_fellow | last post by:
Is *ptr++ equivalent to *(ptr++) ?
4
6190
by: Mike P | last post by:
What is the C# equivalent of Left in VB6? I'm not sure how to translate this line of code : strResultCode = Left$(txtOutput, InStr(1, txtOutput, ",") - 1) Any help would be really appreciated. Cheers,
3
10319
by: Tim Soliday | last post by:
I have been looking at regular expressions lately, and I'm hoping that maybe someone could help me? I am trying to find the position of a substring, and then returning the substring including any information that I might want whether it is to the left or right of that substring. For example: //Position of substring has already been determined
3
15202
by: NathanC | last post by:
Left('ironman',4) Result - 'iron' Is there anyway to excute this task in VB.NET? Currently, I am determing the value of the 4th character, splitting on that, then grabbing the value of the first part of the split. It works, but is really cumbersome and doesn't account for a string with two consecutive values that are the same, but I might want to include both of them Example: ('neccesarry') Result: 'necce'
14
2561
by: grid | last post by:
Hi, I have a certain situation where a particular piece of code works on a particular compiler but fails on another proprietary compiler.It seems to have been fixed but I just want to confirm if both statements are similar : *((char **)v)++ == *((char **)v++) Where v is a pointer to an array of characters,defined as char *v;
2
12203
by: Tasman | last post by:
Is there an equivalent of valign="bottom" for a table within a DIV using CSS? I've found I can center a table of buttons in a DIV with {margin-left:auto; margin-right:auto}. But I am unsure how to get this table to sit at the bottom of the DIV. Example code follows, or see http://home.exetel.com.au/tas/valign/test01.html
1
1563
by: tlemcenvisit | last post by:
Hello, Please, what is the equivalent code of if(e.Button == MouseButtons.Left) in VC++.NET Thanks in advance
0
1299
by: AJ | last post by:
Hi all, I have the following query which isn't quite finished! 1) How do i specify the '@Country' parameter is optional in an ACCESS stored query? (like MSSQL @Country INT = NULL) 2) What is the Access Equivalent of the following AND CLAUSE ? AND c.Country = Coalesce(@Country, c.Country) Query involved below:
0
9931
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9777
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11108
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...
0
10725
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10403
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
9557
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
7956
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
7113
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();...
1
4601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.