472,779 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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 10346
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
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
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
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
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
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
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
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
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
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
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
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.