Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
QuestionDataGridView throws Data Pin
beauroak15-Sep-11 15:15
beauroak15-Sep-11 15:15 
AnswerRe: DataGridView throws Data Pin
Luc Pattyn15-Sep-11 15:29
sitebuilderLuc Pattyn15-Sep-11 15:29 
Questionretrive gridview cell value Pin
jashimu15-Sep-11 9:55
jashimu15-Sep-11 9:55 
AnswerRe: retrive gridview cell value Pin
walterhevedeich15-Sep-11 15:56
professionalwalterhevedeich15-Sep-11 15:56 
Questionhow to write regular expression for this code? Pin
SRKSHOME15-Sep-11 6:48
SRKSHOME15-Sep-11 6:48 
AnswerRe: how to write regular expression for this code? Pin
BillWoodruff15-Sep-11 7:33
professionalBillWoodruff15-Sep-11 7:33 
GeneralRe: how to write regular expression for this code? Pin
SRKSHOME15-Sep-11 19:43
SRKSHOME15-Sep-11 19:43 
AnswerRe: how to write regular expression for this code? Pin
OriginalGriff15-Sep-11 8:26
mveOriginalGriff15-Sep-11 8:26 
You can't - your code is wrong, on a number of levels.
Firstly:
C#
if(!identier.StartsWith("L#")
   identifier.Replace(something,"");
Is incomplete - the if condition is never terminated (you need a ')' in there.

(Assuming you fix that) Secondly:
If identifier starts with "L#" then it won't start with "X#". So, your replace operation will be called by at least one of the first two if conditions, and then always by the third.

(Assuming you fix that) Thirdly:
Strings in .NET are immutable - they cannot be changed - so string.Replace does nothing at all to identifier, but instead generates a new string, which you then discard.

As a result, your entire code block as shown can be replaced by nothing, as it has no effect whatsoever on subsequent code! You don't need a regex for that!

Think again what you are trying to do, and perhaps explain to us what results you are expecting, becauae that is not going to give them to you. Laugh | :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

Manfred R. Bihy: "Looks as if OP is learning resistant."

GeneralRe: how to write regular expression for this code? Pin
PIEBALDconsult15-Sep-11 9:10
mvePIEBALDconsult15-Sep-11 9:10 
GeneralRe: how to write regular expression for this code? Pin
OriginalGriff15-Sep-11 9:15
mveOriginalGriff15-Sep-11 9:15 
GeneralRe: how to write regular expression for this code? Pin
BillWoodruff15-Sep-11 21:42
professionalBillWoodruff15-Sep-11 21:42 
GeneralRe: how to write regular expression for this code? Pin
BillWoodruff15-Sep-11 21:43
professionalBillWoodruff15-Sep-11 21:43 
GeneralRe: how to write regular expression for this code? Pin
SRKSHOME15-Sep-11 20:21
SRKSHOME15-Sep-11 20:21 
GeneralRe: how to write regular expression for this code? Pin
Pete O'Hanlon15-Sep-11 20:32
mvePete O'Hanlon15-Sep-11 20:32 
GeneralRe: how to write regular expression for this code? Pin
SRKSHOME15-Sep-11 21:03
SRKSHOME15-Sep-11 21:03 
AnswerRe: how to write regular expression for this code? Pin
Luc Pattyn15-Sep-11 10:41
sitebuilderLuc Pattyn15-Sep-11 10:41 
GeneralRe: how to write regular expression for this code? Pin
PIEBALDconsult15-Sep-11 14:44
mvePIEBALDconsult15-Sep-11 14:44 
AnswerRe: how to write regular expression for this code? Pin
Luc Pattyn15-Sep-11 14:47
sitebuilderLuc Pattyn15-Sep-11 14:47 
QuestionDifference Between _number and number Pin
eddieangel15-Sep-11 6:11
eddieangel15-Sep-11 6:11 
AnswerRe: Difference Between _number and number Pin
BillWoodruff15-Sep-11 7:08
professionalBillWoodruff15-Sep-11 7:08 
GeneralRe: Difference Between _number and number Pin
eddieangel15-Sep-11 7:10
eddieangel15-Sep-11 7:10 
GeneralRe: Difference Between _number and number Pin
BillWoodruff15-Sep-11 7:40
professionalBillWoodruff15-Sep-11 7:40 
GeneralRe: Difference Between _number and number Pin
eddieangel15-Sep-11 7:46
eddieangel15-Sep-11 7:46 
GeneralRe: Difference Between _number and number Pin
BillWoodruff15-Sep-11 7:58
professionalBillWoodruff15-Sep-11 7:58 
GeneralRe: Difference Between _number and number Pin
eddieangel15-Sep-11 8:00
eddieangel15-Sep-11 8:00 

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.