Click here to Skip to main content
15,921,694 members
Home / Discussions / C#
   

C#

 
AnswerRe: maka a collection Pin
Manas Bhardwaj26-Jun-07 0:19
professionalManas Bhardwaj26-Jun-07 0:19 
QuestionDifference between Object and object Pin
Brendan Vogt25-Jun-07 23:56
Brendan Vogt25-Jun-07 23:56 
AnswerRe: Difference between Object and object Pin
originSH26-Jun-07 0:06
originSH26-Jun-07 0:06 
AnswerRe: Difference between Object and object Pin
Manas Bhardwaj26-Jun-07 0:07
professionalManas Bhardwaj26-Jun-07 0:07 
QuestionHow to write an SDF file Pin
AR Reddy25-Jun-07 23:55
AR Reddy25-Jun-07 23:55 
AnswerRe: How to write an SDF file Pin
originSH26-Jun-07 0:08
originSH26-Jun-07 0:08 
AnswerRe: How to write an SDF file Pin
Manas Bhardwaj26-Jun-07 0:12
professionalManas Bhardwaj26-Jun-07 0:12 
QuestionText Editor Pin
Hum Dum25-Jun-07 22:12
Hum Dum25-Jun-07 22:12 
private void txtBody_TextChanged(object sender, eventArgs e)<br />
{<br />
    if(tbWordwrap.Pushed)<br />
    {<br />
       int maxLength = 65;<br />
       string[] tempArray = new string(txtBody.Lines.length);<br />
       tempArray = txtBody.Lines;<br />
 <br />
       int Prevsel = txtBody.SelectionStart;<br />
       string Op = "";<br />
 <br />
      bool change= false;<br />
 <br />
      for(int counter = 0; counter < tempArray.Length; counter++)<br />
      {<br />
        if (tempArray[counter].length > maxLength )<br />
         {<br />
           string[] Words = tempArray[counter].split(' ');<br />
           int currentLineLength = 0;<br />
           string currentLine = "";<br />
           foreach(string currentWord in Words)<br />
           {<br />
             if(currentWord.length > 0)<br />
             {<br />
              if(currentWord.length >= maxLength)<br />
             {<br />
              Op += curreentWord.Insert(maxLength, "\r\n");<br />
              break;<br />
             }<br />
             if (currentLineLength + currentWord.Length + 1 < maxLength) <br />
             { <br />
<br />
                currentLine += " " + currentWord;<br />
                currentLineLength += (currentWord.Length + 1); <br />
             } <br />
             else<br />
             {<br />
<br />
               Op +=currentLine.insert(currentLineLength,"\r\n);<br />
               currentLine = currentWord;<br />
               currentLineLength = currentWord.Length ; <br />
             } <br />
<br />
          }<br />
         }<br />
         if(currentLine != "")<br />
           Op += currentLine;<br />
<br />
<br />
           Prevsel++;<br />
           change= true;<br />
         }<br />
         else<br />
        {<br />
          Op += tempArray[counter] + "\r\n";<br />
         }<br />
      }<br />
 <br />
      if(change)<br />
      {<br />
        txtBody.Text = Op;<br />
        txtbody.SelectionStart = Prevsel;<br />
      }<br />
}<br />
}<br />
<br />
<br />



Above code is for text editor in which a user can fix no. of characters in single line. If user fix to 65 char then in single line 65 character will appear.

Its working but having some problem,if user types a line
like: "This is trial message."

Now suppose the above character count are equal to 65, the code now supress the spaces in above line,
i.e it modify the line
like: "This is trial message."

It omits the spaces. How can i modify this code that it would also count the spaces, maxLength is variable for the no. of char in a line.
AnswerRe: Text Editor Pin
Christian Graus25-Jun-07 22:57
protectorChristian Graus25-Jun-07 22:57 
Questioncommand line arguments Pin
Maddie from Dartford25-Jun-07 21:47
Maddie from Dartford25-Jun-07 21:47 
AnswerRe: command line arguments Pin
originSH25-Jun-07 22:06
originSH25-Jun-07 22:06 
GeneralRe: command line arguments Pin
Maddie from Dartford25-Jun-07 23:31
Maddie from Dartford25-Jun-07 23:31 
GeneralRe: command line arguments Pin
Christian Graus25-Jun-07 23:38
protectorChristian Graus25-Jun-07 23:38 
GeneralRe: command line arguments Pin
Giorgi Dalakishvili25-Jun-07 23:49
mentorGiorgi Dalakishvili25-Jun-07 23:49 
AnswerRe: command line arguments Pin
Christian Graus25-Jun-07 23:37
protectorChristian Graus25-Jun-07 23:37 
AnswerRe: command line arguments Pin
atulonweb@hotmail.com26-Jun-07 2:23
atulonweb@hotmail.com26-Jun-07 2:23 
QuestionExcel Sheet Pin
hosam Taji25-Jun-07 21:16
hosam Taji25-Jun-07 21:16 
AnswerRe: Excel Sheet Pin
Urs Enzler25-Jun-07 21:21
Urs Enzler25-Jun-07 21:21 
QuestionDebugging Problem Pin
korsosjosi25-Jun-07 21:04
korsosjosi25-Jun-07 21:04 
AnswerRe: Debugging Problem Pin
Luc Pattyn26-Jun-07 1:15
sitebuilderLuc Pattyn26-Jun-07 1:15 
AnswerRe: Debugging Problem Pin
leppie26-Jun-07 2:32
leppie26-Jun-07 2:32 
GeneralRe: Debugging Problem Pin
korsosjosi26-Jun-07 3:12
korsosjosi26-Jun-07 3:12 
QuestionHow to implement a syntax checker using C# ? Pin
I.explore.code25-Jun-07 20:37
I.explore.code25-Jun-07 20:37 
AnswerRe: How to implement a syntax checker using C# ? Pin
Christian Graus25-Jun-07 23:40
protectorChristian Graus25-Jun-07 23:40 
AnswerRe: How to implement a syntax checker using C# ? Pin
Rudolf Jan26-Jun-07 0:11
Rudolf Jan26-Jun-07 0:11 

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.