473,498 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vb.net remove method

Hi,

I'm trying to use the remove method on a string but it doesnt seem to change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will
Jul 21 '05 #1
4 10382
Are you assigning the answer to anything?

name = name.remove(instr(name," ")-1,1)

Chris

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox
to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will

Jul 21 '05 #2
thanks Chris. My bad. I assumed it would place it back into name. Not
enough sleep.

thanks again.
Will

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:O5**************@TK2MSFTNGP09.phx.gbl...
Are you assigning the answer to anything?

name = name.remove(instr(name," ")-1,1)

Chris

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will


Jul 21 '05 #3
Remove + Instr will only remove one occurance. How about using Replace
instead of Remove/InStr?

name = name.Replace(" ", String.Empty);

That's assuming you'd want "Jon Bon Jovi" to become "JonBonJovi" rather than
"JonBon Jovi"

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox
to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will

Jul 21 '05 #4
That'll be easier. Thanks.

Will
"Sean Hederman" <us***@blogentry.com> wrote in message
news:cv**********@ctb-nnrp2.saix.net...
Remove + Instr will only remove one occurance. How about using Replace
instead of Remove/InStr?

name = name.Replace(" ", String.Empty);

That's assuming you'd want "Jon Bon Jovi" to become "JonBonJovi" rather than "JonBon Jovi"

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the remove method on a string but it doesnt seem to
change
it.

name.remove(instr(name," ")-1,1)

If name = bon jovi, I would like bonjovi but I get bon jovi in the msgbox to
display it. I thought it suppose to remove the character space?

Am I doing something wrong?

thanks,
Will


Jul 21 '05 #5

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

Similar topics

12
55523
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
9
36927
by: Ken | last post by:
I am trying to create one image using JavaScript; then later in the script remove the image - not just remove the src. The following creates the image, but I have been unable to remove it. How...
3
3791
by: Don | last post by:
My user control has a combobox with an arraylist attached to it along with custom add and remove methods. The "Add" method is working great. However I don't understand why the "Remove" method...
0
2178
by: a | last post by:
I'm trying to delete an item from a collection, by clicking on a delete button in a GridView control. The item in the collection is stored in the Profile object (serialized as xml in the...
6
7159
by: tshad | last post by:
Is there a reason to use session.remove over session.contents.remove? Don't they both remove the key and data from the contents collection? I assume that session(x) = nothing does essentially...
19
6286
by: brasilino | last post by:
Hi Folks: I've been looking (aka googling) around with no success. I need a usability beyond 'pop()' method when removing an Array elements. For example: oName = new...
7
6583
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
11
4475
by: Richard Maher | last post by:
Hi, I have read many of the copius entries on the subject of IE performance (or the lack thereof) when populating Select Lists. I don't mind the insert performance so much, (I get 100x120byte...
2
1482
by: Nathan Sokalski | last post by:
I have an application that is using Session state. On one page, I use the Session.Add() method to create the Key/Value pair for the first time. I am then sent to another page using...
10
2389
by: Tony Johansson | last post by:
Hello! I have a collection with a lot of object. Each object has the following definition. public class ParametermappingObj { private string Name {get;set;} private string Id {get;set;}...
0
7125
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
7165
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
7203
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
6885
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
5462
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
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1417
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
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.