Wrox Programmer Forums
|
.NET Framework 3.5 For discussion of the Microsoft .NET Framework 3.5.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 3.5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2008, 06:11 AM
Registered User
 
Join Date: Oct 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bettiahamit Send a message via Yahoo to bettiahamit
Default how to create sequence no in c#

here i want to create sequence no. with every paragraph line

..

output like...

<p local_id = P-100>aaaaaaaaaaaaaaaaaaaaaaaaa<\p>
<p local_id = P-101>bbbbbbbbbbbbbbbbbbbbbbbbb<\p>
<p local_id = P-102>vvvvvvvvvvvvvvvv<\p>



and show in richtextbox control..but he didn't work.

here is my code:-

richTextBox1.LoadFile(filepath,RichTextBoxStreamTy pe.RichText);
string inputstring = richTextBox1.Text;
StringBuilder sb = new StringBuilder(inputstring);
sb.Insert(0, "");
sb.Replace("\n", "" + "\n" + "");
sb.Replace("", "");
sb.Append("");
sb.Replace("", "");
sb.Replace("\n\n", "\n");
sb.Replace("\n\n", "\n");
sb.Replace("\n\n", "\n");
sb.Replace("\n\n", "\n");
sb.Replace("\n\n", "\n");
sb.Replace("\n\n", "\n");
richTextBox1.Text = sb.ToString();



 
Old November 6th, 2008, 06:25 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Wow, weirdest code sample ever.

You do realise that the first 4 lines on your StringBuilder do absolutely nothing (one inserts nothing at the start, then you replace a line break with empty strings, plus a line break, then replace nothing with, err, nothing, and finally append, err, nothing... oh, and then replace nothing with nothing again.)

And secondly your code sample appears to have nothing to do with the XML (or rather invalid XML) that you showed in the first part?

If you want to increment a number in C#, then surely int i = 1; i++; would do it...

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
comparison using a sequence pcase XSLT 1 December 3rd, 2007 07:33 PM
Retrieving strings in sequence lowell VB.NET 1 March 8th, 2007 06:31 PM
Processing first node in a sequence djmarquette XSLT 3 November 15th, 2005 01:05 PM
value from a sequence suhabassam JSP Basics 0 September 27th, 2005 01:33 AM
Sequence of For-each elements? brendonsmith XSLT 2 January 14th, 2004 05:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.