Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Error im getting

Error 1 'SimpleWebBrowser.Form1.button3_Click(object, System.EventArgs)' must declare a body because it is not marked abstract, extern, or partial

My Code

XML
using System;
using System.Windows.Forms;

namespace SimpleWebBrowser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// This will close the application when the File-&gt;Exit menu item is selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// This will show a box with the author information when the about menu item is selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("simple web browser nothing to it");
        }

        /// <summary>
        /// On click of this button the web control will display the page requested in the text box (by url)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            SearchteToPage();
        }

        private void SearchteToPage()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// This function will cause the browser to navigate to the URL in the textBox1 control
        /// </summary>
        private void aearchteToPage()
        {
            toolStripStatusLabel1.Text = "Navigation has started";
            webBrowser1.Navigate(textBox1.Text);
        }

        /// <summary>
        /// This function will start navigation by simulating a click on the navigate button when 'enter' is pressed when textbox1 is in focus
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            // if the keystroke was enter then do something
            if (e.KeyChar == (char)ConsoleKey.Enter)
            {
                //NavigateToPage();
                button1_Click(null, null);
            }
        }

        /// <summary>
        /// When the webpage is finished loading this function will re-enable the disabled controls and indicate success
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            // Enable the controls that were disabled during navigation
            button1.Enabled = true;
            textBox1.Enabled = true;

            // Indicate loading is complete
            toolStripStatusLabel1.Text = "Navigation Complete";
            toolStripProgressBar1.ProgressBar.Value = 100;
        }

        /// <summary>
        /// This function will be called as the webpage loads multiple time to indicate the percentage complete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
        {
            // Don't bother computing percentage if either variable is zero since it will cause a divide by zero error
            if (e.CurrentProgress &gt; 0 && e.MaximumProgress &gt; 0)
            {
                // Calculate percentage
                int percentage = (int)(e.CurrentProgress * 100 / e.MaximumProgress);

                // If the percentage is &gt; 100 it means additional processing was done on the page so we want to ignore it
                if (percentage &lt;= 100)
                {
                    toolStripProgressBar1.ProgressBar.Value = percentage;
                }
            }
            else
            {
                // Set the percentage to zero if we can't compute it
                toolStripProgressBar1.ProgressBar.Value = 0;
            }
        }


        //start of button two code
        //Right here
        //right here

        private void historyToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }



//ERROR LINE'S START HERE
        private void button3_Click(object sender, EventArgs e);

        private void button4_Click(object sender, EventArgs e)
        {
            Y_searchteToPage();
        }

        private void Y_searchteToPage()
        {
            throw new NotImplementedException();
        }

        private void Y_SearchteToPage()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// This function will cause the browser to navigate to the URL in the textBox1 control
        /// </summary>
        private void Y_aearchteToPage()
        {
            toolStripStatusLabel1.Text = "Navigation has started";
            webBrowser1.Navigate(textBox2.Text);
        }
    }
}
Posted
Updated 11-Jul-15 9:23am
v3

1 solution

The error actually says it all:
button3_Click(object, System.EventArgs)' must declare a body because it is not marked abstract, extern, or partial

You probably have a button object named button3 drawn in your UI and you have wired a click event for it.

Anyways, you need to modify the method so that it has a body. So instead of
C#
private void button3_Click(object sender, EventArgs e);

you should have something like
C#
private void button3_Click(object sender, EventArgs e) {
... do something over here...
}

If that method isn't actually needed, either comment it out or remove it completely.
 
Share this answer
 
Comments
Member 11830477 11-Jul-15 15:48pm    
thank you that indeed fixed it im a little new to C#
Wendelius 11-Jul-15 15:57pm    
You're most welcome :)
Sergey Alexandrovich Kryukov 11-Jul-15 23:34pm    
5ed.
—SA
Wendelius 12-Jul-15 3:06am    
Thanks SA :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900