Click here to Skip to main content
15,911,848 members
Home / Discussions / C#
   

C#

 
Questionlanguage localization and pictures Pin
lushgrass21-Sep-06 22:45
lushgrass21-Sep-06 22:45 
AnswerRe: language localization and pictures Pin
lmoelleb22-Sep-06 0:34
lmoelleb22-Sep-06 0:34 
GeneralRe: language localization and pictures Pin
lushgrass25-Sep-06 15:45
lushgrass25-Sep-06 15:45 
Questionsending data over Network [modified] Pin
sanifant21-Sep-06 22:33
sanifant21-Sep-06 22:33 
AnswerRe: sending data over Network Pin
Green Fuze22-Sep-06 23:34
Green Fuze22-Sep-06 23:34 
GeneralRe: sending data over Network Pin
sanifant25-Sep-06 0:20
sanifant25-Sep-06 0:20 
GeneralRe: sending data over Network Pin
Green Fuze25-Sep-06 10:30
Green Fuze25-Sep-06 10:30 
QuestionAuto generated schema Pin
DanB198321-Sep-06 22:27
DanB198321-Sep-06 22:27 
AnswerRe: Auto generated schema Pin
DanB198322-Sep-06 3:56
DanB198322-Sep-06 3:56 
QuestionProblem with IIF() Pin
M Riaz Bashir21-Sep-06 21:45
M Riaz Bashir21-Sep-06 21:45 
AnswerRe: Problem with IIF() Pin
J4amieC21-Sep-06 21:50
J4amieC21-Sep-06 21:50 
AnswerRe: Problem with IIF() Pin
Guffa21-Sep-06 23:48
Guffa21-Sep-06 23:48 
GeneralRe: Problem with IIF() Pin
J4amieC21-Sep-06 23:59
J4amieC21-Sep-06 23:59 
Questiontrim away last 4 characters of a string Pin
Support12321-Sep-06 21:23
Support12321-Sep-06 21:23 
AnswerRe: trim away last 4 characters of a string Pin
Stefan Troschuetz21-Sep-06 21:34
Stefan Troschuetz21-Sep-06 21:34 
GeneralRe: trim away last 4 characters of a string Pin
Support12321-Sep-06 21:46
Support12321-Sep-06 21:46 
GeneralRe: trim away last 4 characters of a string Pin
Stefan Troschuetz21-Sep-06 21:51
Stefan Troschuetz21-Sep-06 21:51 
GeneralRe: trim away last 4 characters of a string Pin
Support12321-Sep-06 21:53
Support12321-Sep-06 21:53 
AnswerRe: trim away last 4 characters of a string Pin
Guffa22-Sep-06 0:04
Guffa22-Sep-06 0:04 
NarutoFan#1 wrote:
would it work, if i use one of the examples someone gave me, to do it like this...

strName[strName.Length-1] = string.Empty;


Who gave you that example? That is not even close to something that would work.

The indexer property of a string returns a character, so the value of strName[strName.Length-1] is a character value. The property is read only (as strings can not be changed), so you can not give the character a new value. Even if you could, you would not be able to change the length of the string, and you would not be able to put in a string in place of the character.

As you can not change a string, the only way to get a string with a different contents is to create a new string that contains what you want. The SubString method (as suggested by Stefan) does this. The Remove method can also be used:

strName = strName.Remove(strName.Lenght - 4, 4);


---
b { font-weight: normal; }

GeneralRe: trim away last 4 characters of a string Pin
Support12322-Sep-06 0:17
Support12322-Sep-06 0:17 
GeneralRe: trim away last 4 characters of a string Pin
Guffa22-Sep-06 0:34
Guffa22-Sep-06 0:34 
GeneralRe: trim away last 4 characters of a string Pin
Support12322-Sep-06 0:42
Support12322-Sep-06 0:42 
GeneralRe: trim away last 4 characters of a string Pin
Support12322-Sep-06 0:20
Support12322-Sep-06 0:20 
Questioncheck boxes in C#.net 2005 Pin
Rohit Dev21-Sep-06 21:13
Rohit Dev21-Sep-06 21:13 
AnswerRe: check boxes in C#.net 2005 Pin
Guffa21-Sep-06 21:23
Guffa21-Sep-06 21:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.