473,473 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VbScript Left(string,int) equivalent in VB.NET?

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'

I know that I can't just use Left() because that is now something to do with
image control.

I'm a .NET newbie and this would make my task much simpler.
Thanks!

Dec 5 '05 #1
3 15180
"NathanC" <Na*****@discussions.microsoft.com> schrieb:
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'

I know that I can't just use Left() because that is now something to do
with
image control.


You can still use 'Left'. In Windows Forms forms and controls you'll have
to qualify the method ('Strings.Left') because 'Left' will clash with the
control's 'Left' property.

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

Dec 5 '05 #2
Hi,

Take a look at the string's substringmethod.

http://msdn.microsoft.com/library/de...ringtopic2.asp

Dim strTest As String = "ironman"

Debug.WriteLine(strTest.Substring(0, 4))

Ken
---------------------
"NathanC" <Na*****@discussions.microsoft.com> wrote in message
news:B1**********************************@microsof t.com...
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'

I know that I can't just use Left() because that is now something to do
with
image control.

I'm a .NET newbie and this would make my task much simpler.
Thanks!

Dec 5 '05 #3
Herfried,
will clash with the control's 'Left' property.


Although that your answer is correct, do I think that for obvious newbies
this can better be written as.

will clash with the 'Left' property from the form.

This message is for the OP as well of course.

Cor
Dec 6 '05 #4

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

Similar topics

4
by: mhw | last post by:
I don't found function! ThanksŁˇ
3
by: Mark Fox | last post by:
Hello, I am porting some old ASP 3.0 VBScript code to C#.NET and am not sure what the equivalent C# functions are for a couple VBScript functions. So my first question is: 1) Is there...
3
by: Andi Twine | last post by:
Hi all, I really hope someone here can help ! I have designed and built an ASP.NET web service with Visual Studio .NET. The web service outputs some dummy XML data when its called with some...
2
by: Vance Kessler | last post by:
We are trying write a new ASP.NET page to work with an existing stateless ASP application. The ASP application creates a cookie and of course stores the cookie values as escaped strings (using the...
3
by: Sam | last post by:
I want to divide character into 2 section. Example, 200412 divided into 2004 in A block and 12 in B block. Please advise how to use left(string, length) or right(string, length) for above...
3
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question. I was wondering if there is anything in C# that corresponds to VB's "Left" function? I simply want to retrieve the leftmost characters of a string and I...
3
by: AWW | last post by:
RichTextBox.Text = string & vbCR works but if I extract a substring with microsoft.visualbasic.left then vbCR stops working. I can do F5 executes with/without the Left and the vbCr does/doesNot...
5
by: =?Utf-8?B?Qm9iQWNoZ2lsbA==?= | last post by:
I need a function (or code) that will physically change the words in a text string to make the first word be last, second word next to last, etc. but maintain the same position of the letters in...
2
by: ventos | last post by:
First of all, ive been trying to learn c++ for a couple of days ;) Problem i need to strip http links from string code: string replaceAll(string s, string f, string r) { unsigned int found...
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
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,...
0
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...
1
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...
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.