0

I am writing a c# program, which is used for generating an HTML file and calls a JavaScript function when a button is clicked in the WPF project. However, when I use the function, it throws an error.

Error message: A using namespace directive can only be applied to namespaces; 'System.Object' is a type not a namespace

Part of my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using System.Windows.Forms;
using System.Object;

namespace HTMLtesting
{
    public partial class MainWindow : Window
    {

        public MainWindow()
        {
            InitializeComponent();
            createHTMLPage();
        }

        private void stopButton_Click(object sender, RoutedEventArgs e)
        {
            webBrowser1.Document.InvokeScript("stopPlaying");
        }
Divi
  • 7,621
  • 13
  • 47
  • 63
ahSa
  • 19
  • 2

1 Answers1

2

Try to remove

using System.Object;

  • Thx first, I have try this before. But after delete this, another error :'object' does not contain a definition for 'InvokeScript' and no extension method 'InvokeScript' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) – ahSa Feb 24 '12 at 04:25