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.VisualBasic.Left but I suspect there is a .NET method to
accomplish this?
Wayne 9 19945
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**************@TK2MSFTNGP09.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.VisualBasic.Left but I suspect there is a .NET method to accomplish this? Wayne
"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.VisualBasic.Left but I suspect there is a .NET method to accomplish this?
Left: txtTextbox1.text.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
Peter,
"Peter Proost" <pp*****@nospam.hotmail.com> schrieb: Strings.Left() Strings.Right()
.... these methods are the methods mentioned by the OP
('Microsoft.VisualBasic.Strings.{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/>
Thanks for the responses guys.
Wayne
"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:%2****************@TK2MSFTNGP09.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.VisualBasic.Left but I suspect there is a .NET method to accomplish this? Wayne
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**************@TK2MSFTNGP12.phx.gbl... Peter,
"Peter Proost" <pp*****@nospam.hotmail.com> schrieb: Strings.Left() Strings.Right() ... these methods are the methods mentioned by the OP ('Microsoft.VisualBasic.Strings.{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/>
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/>
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.VisualBasic.Strings.
What I normally do is use an import alias (in my forms & other types):
Imports VB = Microsoft.VisualBasic
strString = VB.Left(txtTextbox1.Text, 20)
Hope this helps
Jay
"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:%2****************@TK2MSFTNGP09.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.VisualBasic.Left but I suspect there is a .NET method to
| accomplish this?
|
|
|
| Wayne
|
|
> What I normally do is use an import alias (in my forms & other types): Imports VB = Microsoft.VisualBasic
strString = VB.Left(txtTextbox1.Text, 20)
Cool! I did NOT know that! (Johnny Carson voice). You learn something new
every day around here :)
Jay;
Thanks for that tip.
Wayne
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:O$**************@tk2msftngp13.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.VisualBasic.Strings.
What I normally do is use an import alias (in my forms & other types):
Imports VB = Microsoft.VisualBasic
strString = VB.Left(txtTextbox1.Text, 20)
Hope this helps Jay
"Wayne Wengert" <wa***********@wengert.org> wrote in message news:%2****************@TK2MSFTNGP09.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.VisualBasic.Left but I suspect there is a .NET method to | accomplish this? | | | | Wayne | |
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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.
...
|
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",...
|
by: junky_fellow |
last post by:
Is *ptr++ equivalent to *(ptr++) ?
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: tlemcenvisit |
last post by:
Hello,
Please, what is the equivalent code of
if(e.Button == MouseButtons.Left)
in VC++.NET
Thanks in advance
|
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...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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)...
|
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...
|
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....
|
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...
| |