Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8797601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:53:15+00:00 2026-06-13T23:53:15+00:00

I’m getting the above error. I saw other similar posts on this error but

  • 0

I’m getting the above error. I saw other similar posts on this error but I don’t seem to find where the problem is. I changed my class type to static and the error resists. This is the entire code to my main form class:

I Edited my class. This is how it looks like now and the error has changed to:Missing partial modifier on declaration of type ‘PhoneFind.frmMain’; another partial declaration of this type exists.

namespace PhoneFind
{
    public partial class frmMain : Form
    {
        // the path to the temporary file to store the webresponse
        String path = "c:\\Temp\\webresponse.txt";
        public frmMain()
        {
            InitializeComponent();
            comboSelectSearchEngine.SelectedIndex = 0;
            ofdPhones.Filter = "txt files (*.txt)|*.txt";
            listbxMessages.Items.Clear();
            addItemToListBox(listbxMessages, "Welcome to ActionBase Phone Find!");
            addItemToListBox(listbxMessages, "Select the file containing the numbers.");
            radioNumbers.Checked = true;
        }

        private void frmMain_Load(object sender, EventArgs e)
        {

        }

        private void btnLoadFile_Click(object sender, EventArgs e)
        {
            if (ofdPhones.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txtFile.Text = ofdPhones.FileName;

                // Read the file line by line and add the numbers to the numbers listbox.
                listbxNumbers.Items.Clear();
                String line;
                int numbersCounter = 0;
                System.IO.StreamReader file = new System.IO.StreamReader(ofdPhones.FileName);
                while ((line = file.ReadLine()) != null)
                {
                    listbxNumbers.Items.Add(line.Trim());
                    numbersCounter++;
                }
                addItemToListBox(listbxMessages, ofdPhones.FileName + " loaded.");
                addItemToListBox(listbxMessages, numbersCounter + " records found in the file.");

            }
        }

        // add item to the listbox and move scroll to the end of the listbox for the latest messages to be visibile to the viewer
        private void addItemToListBox(ListBox listbox, String item)
        {
            listbox.Items.Add(item);
            listbox.SelectedIndex = (listbox.Items.Count - 1);
        }

        private void radioNumbers_CheckedChanged(object sender, EventArgs e)
        {
            if (!radioNumbers.Checked)
            {
                grpbxNumbers.Text = "Names and Addresses";
            }
            else
            {
                grpbxNumbers.Text = "Numbers";
            }
        }

        private void btnRun_Click(object sender, EventArgs e)
        {
            if (listbxNumbers.Items.Count == 0)
            {
                MessageBox.Show("No records have been loaded." + "\n" + "Use the browse button to load records.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (!CheckForInternetConnection())
            {
                MessageBox.Show("No internet connection.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                String response;
                switch (comboSelectSearchEngine.SelectedIndex)
                {
                    case 0: // Hitta.se
                        foreach (String item in listbxNumbers.Items)
                        {
                            WebRequestObj request = new WebRequestObj(item, "hitta");
                            response = request.sendRequest();
                            if (response.Equals("Error"))
                            {
                                addItemToListBox(listbxMessages, "Error sending '" + item + "' to the server.");
                            }
                            else
                            {
                                //create a temporary file to work on the response
                                StreamWriter sw;
                                if (!File.Exists(path)) {
                                    sw = File.CreateText(path);
                                }
                                try
                                {
                                    File.WriteAllText(path, String.Empty); // clear the content of the file
                                    sw = File.AppendText(path);
                                    sw.WriteLine(response);
                                    sw.Flush();
                                    sw.Close();
                                    String s = findResultType(path);
                                    MessageBox.Show(s);
                                }
                                catch (IOException ioe)
                                {
                                    MessageBox.Show(ioe.Message,"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }


                            }
                        }
                        break;
                }
            }
        }

        public bool CheckForInternetConnection()
        {
            try
            {
                using (var client = new System.Net.WebClient())
                using (var stream = client.OpenRead("http://www.google.com"))
                {
                    return true;
                }
            }
            catch
            {
                return false;
            }
        }

        /*
         * findResultType
         * gets the web response and finds out if the matching result of the search termis one of the following:
         * 1. one person (oneperson)
         * 2. one company (onecompany)
         * 3. more than one person, no company (manypersonnocompany)
         * 4. no person, more than one company (nopersonmanycompany)
         * 5. more than one person, more than one company (manypersonmanycompany)
         * 6. no person, no company (nopersonnocompany)
         */
        public String findResultType(String reponsepath)
        {                   
            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.Load(reponsepath);
            List<String> itemList = new List<String>();
            IEnumerable<String> v = null;
            var item = doc.DocumentNode.SelectNodes("//body[@id='person']");

            if (item != null)
            {
                v = item.Select(p => p.InnerText);
                itemList = v.ToList();
                if (itemList.Count == 1)
                    return "oneperson";
            }
            else
            {
                item = doc.DocumentNode.SelectNodes("//body[@id='company']");
                if (item != null)
                {
                    v = item.Select(p => p.InnerText);
                    itemList = v.ToList();
                    if (itemList.Count == 1)
                        return "onecompany";
                }
            }

            //for (int i = 0; i < itemList.Count; i++)
            //{
            //    MessageBox.Show(itemList[i]);
            //    //console.writeline(itemlist[i]);
            //}
            //console.writeline(itemlist.count + " results found.");
            return "";
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:53:16+00:00Added an answer on June 13, 2026 at 11:53 pm

    This is your first problem:

    public static class frmMain : Form
    

    You can’t derive a static class from another class. A static class always implicitly derives from Object. You also can’t have non-static members in static classes.

    So basically, you can’t put your extension method in your frmMain class (which should be renamed to follow .NET naming conventions and to be somewhat more descriptive at the same time). Why did you want to put the extension method in that class anyway?

    I can’t even see an extension method in the code you’ve posted – did you remove it? Is it in some other class you haven’t posted?

    Fundamentally, I think you need to take a step back. It sounds like you’ve reacted to the compiler error message without really understanding it fully. Read up on extension methods, read up on what static classes are, until you really understand why you don’t want your form class to be static, and why you do want to make the class that contains your extension method static.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.