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

  • SEARCH
  • Home
  • 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 7047585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:47:22+00:00 2026-05-28T02:47:22+00:00

The code below contains a whole bunch of error messages, and I can’t for

  • 0

The code below contains a “whole bunch” of error messages, and I can’t for the life of me figure out why. I recently had to “downgrade” from VS2010 to VS2008, and have had nothing but misery since. The first few error messages are shown as comments next to where they are occurring.

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;

namespace UniClient_NextGen
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void buttonPopMenuItemsLU_Click(object sender, RoutedEventArgs e) 
        { // err msg #1 = "} expected"
            public static int TOPLEVEL_ID = 0;
            public static int PARENT_ID = 1;
            public static int SELF_ID = 2;
            public static int MENU_CAPTION = 3;
            public static int MENU_NAME = 4;

            string fileName = @"C:\_UniClientNextGen\MenuItemsWithIDs.txt";
            using (StreamReader reader = File.OpenText(fileName)) // err msg #2 = "Invalid token 'using' in class, struct, or interface member declaration" + err msg #3 = "; expected" (at end of this line)
            {
                string _line = null;
                string[] strElements;
                do
                {
                    _line = reader.ReadLine();
                    strElements = _line.Split(",");
                    // strElements should now have five elements
                    int iTopLevelID = Convert.ToInt32(strElements[TOPLEVEL_ID]);
                    int iParentID = Convert.ToInt32(strElements[PARENT_ID]);
                    int iOwnID = Convert.ToInt32(strElements[SELF_ID]);
                    string sMenuCaption = strElements[MENU_CAPTION];
                    string sMenuName = strElements[MENU_NAME];
                    //performSQL("INSERT INTO MENU_ITEMS_LOOKUP (TopLevelMenuID, ParentMenuID, MenuItemName, MenuItemCaption) VALUES (iTopLevelID, iParentID, iOwnID, sMenuCaption, sMenuName)");
                } while (_line != null);
            }
        } // err msg #4 = "Type or namespace definition, or end-of-file expected" 

        private void buttonPopSorterTypesLU_Click(object sender, RoutedEventArgs e)
        {
            //
        }

        private void buttonPopTabsheetsLU_Click(object sender, RoutedEventArgs e)
        {
            //
        }

        private void buttonPopMenuItem_SorterTypeM2M_Click(object sender, RoutedEventArgs e)
        {
            //
        }

        private void buttonPopSorterType_TabsheetM2M_Click(object sender, RoutedEventArgs e)
        {
            //
        }
    }
}
  • 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-05-28T02:47:22+00:00Added an answer on May 28, 2026 at 2:47 am

    Here is the corrected code (I have moved static member declaration in right place and corrected the _line.Splt() parameter):

    //...
    public static int TOPLEVEL_ID = 0;
    public static int PARENT_ID = 1;
    public static int SELF_ID = 2;
    public static int MENU_CAPTION = 3;
    public static int MENU_NAME = 4;
    
    void buttonPopMenuItemsLU_Click(object sender, RoutedEventArgs e) {
        string fileName = @"C:\_UniClientNextGen\MenuItemsWithIDs.txt";
        using(StreamReader reader = File.OpenText(fileName)) {
            string _line = null;
            string[] strElements;
            do {
                _line = reader.ReadLine();
                strElements = _line.Split(',');
                int iTopLevelID = Convert.ToInt32(strElements[TOPLEVEL_ID]);
                int iParentID = Convert.ToInt32(strElements[PARENT_ID]);
                int iOwnID = Convert.ToInt32(strElements[SELF_ID]);
                string sMenuCaption = strElements[MENU_CAPTION];
                string sMenuName = strElements[MENU_NAME];
            } while(_line != null);
        }
    }
    //...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello friends i am running code given below which contains the setLogTimeEntery function and
The code below works great. I have a MySQL database that contains book titles
I have the below code for my a Dialog box for a which contains
Below is my entire code from a User control that contains the YUI Uploader.
I have a form which contains a whole bunch of checkboxes and some other
Form contains two dropdown lists created using code below. Both dropdown list elements have
I'm getting a syntax error while using the code below. it suppoused to avoid
I have below code.The logic here is if HostList conatains any blanck entry it
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code below is not working as expected to detect if it is in design

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.