Web browser splash screen C#

C#  2005 Express Edition

Hi. I am a beginner and I am working on my first project in C# following the 'Build a Program NOW' guide that was downloaded as part of the express edition package for C#.

The project is a web browser which I am adding the code for a splash screen on page 86 of the guide. I have made no changes to the code and only a few changes to the splash screen properties itself which shouldn't have affected much more than colors and graphics. I have been able to resolve all the errors that were presented except for this one.

Error:  Expected class, delegate, enum, interface or struct

Line:  private void Splash_Load(object sender, EventArgs e)

Of course the splash screen will not load. I don't understand enough to know what the error means and need help. If you need more info or the entire splash code being used, I can provide that.

Help :(

Anderson



Answer this question

Web browser splash screen C#

  • Philippe Jan

    Can you provide a little more context Can you post the code around where this line is present

  • _w_

    David;

    I took an apparently much needed break, then came back and reread every single stitch of code in my project! It turns out that the line I was referring to, did in fact come from one of the other code views and I must have somehow copied it over (although I'm not quite sure how it happened).

    After I removed the string alltogether, and fixed a minor glitch that took it's place, the splash screen came up ok. Sorry to waste your time!


  • MartinaM

    Hi David;

    Wasn't sure how much code you wold need but this is part of what is immediately above and below the string mentioned earlier:

    public string AssemblyCompany

    {

    get

    {

    // Get all Company attributes on this assembly

    object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(

    typeof(AssemblyCompanyAttribute), false);

    // If there aren't any Company attributes, return a string

    if (attributes.Length == 0)

    return "";

    //If there is a Company attribute, return it's value

    return ((AssemblyCompanyAttribute)attributes[0]).

    Company;

    }

    }

    #endregion

    }

    }

    private void Splash_Load(object sender, EventArgs e)

    {

    }

     

    // The string in question: private void Splash_Load(object sender, EventArgs e) was originally included somewhere in the first part of the code:

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    using System.Reflection;

    namespace Rogue_Explorer

    {

    public partial class Splash : Form

    {

    public Splash()

    {

    InitializeComponent();

     

    //However, according to the guide, I added the rest of the code accordingly and this one string was what was left over....It makes me wonder if somehow I managed to accidently cut it from one of the other code views I was working in perhaps

     


  • Web browser splash screen C#