none
Problem Hilfe RRS feed

  • Frage

  • Hallo ich habe eine Suchfunktion in meine Studio Software eingebaut die einwandfrei läuft. das Problem:

    Ich bekomme immer folgende Fehler Meldung " Warning CS0169 The field 'Form1.word' is never used"

    bedeutet ja eigentlich das etwas angefangenes noch nicht fertig ist.

    Sorry bin gerade einfach zu dämlich die Lösung zu finden sitze schon stundenlang am Quellcode.

    mein Code:

     public partial class Form1 : Form
        {
            private int hr, min, sec;
            private string word;
    
            public Form1()
    
    ....
    
    
     //Search Function
            }
    
            private void Enter_Click(object sender, EventArgs e)
            {
                string[] words = Search.Text.Split(',');
                foreach (string word in words)
                {
                    int startIndex = 0;
                    while (startIndex < richTextBox1.TextLength)
                    {
                        int wordStartIndex = richTextBox1.Find(word, startIndex, RichTextBoxFinds.None);
                        if (wordStartIndex != -1)
                        {
                            richTextBox1.SelectionStart = wordStartIndex;
                            richTextBox1.SelectionLength = word.Length;
                            richTextBox1.SelectionBackColor = Color.Gold;
    
    
                        }
                        else
                            break;
                        startIndex += wordStartIndex + word.Length;
                    }
    
                }
            }
           
            
            // Clear search 
            private void Clear_Click(object sender, EventArgs e)
            {
                richTextBox1.SelectionStart = 0;
                richTextBox1.SelectAll();
                richTextBox1.SelectionBackColor = Color.White;
            }

     

    Sonntag, 1. Januar 2017 23:24

Antworten

Alle Antworten