Click here to Skip to main content
15,891,204 members
Home / Discussions / C#
   

C#

 
AnswerURGENT!!! HOMEWORK!!! Pin
J4amieC3-Sep-07 2:58
J4amieC3-Sep-07 2:58 
AnswerRe: [Message Deleted] Pin
Colin Angus Mackay3-Sep-07 3:58
Colin Angus Mackay3-Sep-07 3:58 
GeneralRe: [Message Deleted] Pin
Paul Conrad3-Sep-07 7:52
professionalPaul Conrad3-Sep-07 7:52 
GeneralRe: [Message Deleted] Pin
Colin Angus Mackay3-Sep-07 8:06
Colin Angus Mackay3-Sep-07 8:06 
GeneralRe: [Message Deleted] Pin
Paul Conrad3-Sep-07 8:25
professionalPaul Conrad3-Sep-07 8:25 
QuestionNeed code for Word Wrapping- Plz help Pin
Hum Dum3-Sep-07 2:12
Hum Dum3-Sep-07 2:12 
AnswerRe: Need code for Word Wrapping- Plz help Pin
Luc Pattyn3-Sep-07 5:15
sitebuilderLuc Pattyn3-Sep-07 5:15 
GeneralRe: Need code for Word Wrapping- Plz help Pin
Hum Dum4-Sep-07 19:05
Hum Dum4-Sep-07 19:05 
The code is working but with some problem?
If user inputs some lines and come back to previous line, like editing the text, then problem occurs like its overwriting.
Ex line:"1. This Code is giving me much problem as i m fresher."
like this user enter 3-4 lines or paragraph?

Now if user comes back to 1 line and edit, its messed up like:
"1. This code hai s giving me much problem as i m fresher."

Here i try to enter have after code.
Plz help.

private void txtBody_TextChanged(object sender, eventArgs e)
{


if(tbWordwrap.Pushed) 
   {       
	string[] tempArray = new string(txtBody.Lines.length);       	
	tempArray = txtBody.Lines;        
	int Prevsel = txtBody.SelectionStart;       
	string Op = "";      
	int maxLength = cINI.dbUtils.Pref.DefaultEditorWidth;       	
	bool change= false;       
	for(int cou = 0; cou < tempArray.Length ; cou++)
        {        
	if (tempArray[cou].length > maxLength)         	
	{           
		string words = tempArray[cou].split(' ');
	        int currentLine Length = 0;           
		string currentLine = "";            
		foreach(string currentWords in words)
	           {            
			if(currentWord.Length > 0)            
			{               
				if(currentword.Length >= maxLength)              
				 {               
					 Op += currentword.Insert(maxLength, "\r\n");
			                 break;               
				}            
				 if(currentLineLength + currentword.Length + 1 < maxLength)
		                 {                
					currentLine += currentword + " ";
			                currentLineLength += currentword.Length +1;

            			 }            
				 else             
				{               
					Op +=currentLine.Insert(currentLineLength, "\r\n");
			               currentLine = currentWord;   
			               currentLineLength = currentWord.Length;
		                }
	               }
	             }         
		if(currentLine !="") 
		         Op += currentLine;

                PrevSel++;           
		change = true;      
	}
      else
      { 
       Op += tempArray[cou] + "\r\n";
      }
   if(change)
   {
     txtBody.Text = Op;
     txtBody.SelectionStart = prevSel;
   }
 }
}


The above code is for text_change event of RichText Box in C# vs.net 2003.

GeneralRe: Need code for Word Wrapping- Plz help Pin
Luc Pattyn5-Sep-07 8:50
sitebuilderLuc Pattyn5-Sep-07 8:50 
GeneralNo where to go........- Plz help Pin
Hum Dum18-Sep-07 19:12
Hum Dum18-Sep-07 19:12 
AnswerRe: TRICKY&CHALLENGING LOOP Pin
Pete O'Hanlon3-Sep-07 2:12
mvePete O'Hanlon3-Sep-07 2:12 
QuestionConersion to DateTime Data type from String Pin
Prashant C3-Sep-07 2:02
Prashant C3-Sep-07 2:02 
AnswerRe: Conersion to DateTime Data type from String Pin
darkcalin3-Sep-07 4:06
darkcalin3-Sep-07 4:06 
QuestionI'm lost while looping! Pin
Muammar©3-Sep-07 1:46
Muammar©3-Sep-07 1:46 
AnswerRe: I'm lost while looping! Pin
Pete O'Hanlon3-Sep-07 2:00
mvePete O'Hanlon3-Sep-07 2:00 
GeneralRe: I'm lost while looping! Pin
Muammar©3-Sep-07 2:15
Muammar©3-Sep-07 2:15 
GeneralRe: I'm lost while looping! Pin
Pete O'Hanlon3-Sep-07 2:23
mvePete O'Hanlon3-Sep-07 2:23 
QuestionUsing gSOAP with C# Pin
Zahid Ajaib3-Sep-07 1:14
Zahid Ajaib3-Sep-07 1:14 
QuestionCABing UnCABing... Pin
Bhavesh Bagadiya3-Sep-07 0:35
Bhavesh Bagadiya3-Sep-07 0:35 
AnswerRe: CABing UnCABing... Pin
Bhavesh Bagadiya3-Sep-07 2:35
Bhavesh Bagadiya3-Sep-07 2:35 
GeneralRe: CABing UnCABing... Pin
Vasudevan Deepak Kumar3-Sep-07 2:39
Vasudevan Deepak Kumar3-Sep-07 2:39 
QuestionIs Crystal Report is not come with .Net Framework? Pin
Kumar Arun3-Sep-07 0:25
Kumar Arun3-Sep-07 0:25 
AnswerRe: Is Crystal Report is not come with .Net Framework? Pin
J4amieC3-Sep-07 0:39
J4amieC3-Sep-07 0:39 
GeneralRe: Is Crystal Report is not come with .Net Framework? Pin
Vasudevan Deepak Kumar3-Sep-07 1:34
Vasudevan Deepak Kumar3-Sep-07 1:34 
QuestionParsing XML from a string Pin
Anders Molin3-Sep-07 0:00
professionalAnders Molin3-Sep-07 0: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.