简体   繁体   中英

Windows Form Application C sharp visual studio 2010

I am making an UNO game application. I conveniently created a form2 (game table) with all the players and their cards being displayed etc. Now, I just want to add a text box to show the current player.

So what i did was -

  1. Dragged and dropped a text box. Warning - Warning 1 You must rebuild your project for the changes to Gui1.Form2 to show up in any open designers. 0 0

  2. Rebuild da form -

I see another file being created - form21.designer.cs. Pl. see the contents of file below -

Error - Error 1 Missing partial modifier on declaration of type 'Gui1.Form2'; another partial declaration of this type exists C:\\Users\\uday\\Desktop\\Uday\\Client_0407\\Gui1\\Form21.Designer.cs 25 18 Gui1

NOTE - It is not just with textbox only. If I do any drag and drop modifications, same happens.

form21.designer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Gui1 {
    using System;


    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class Form2 {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Form2() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gui1.Form2", typeof(Form2).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        public static System.Drawing.Bitmap Pic_MyPlayer_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_MyPlayer.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        public static System.Drawing.Bitmap Pic_OtherPlayer1_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_OtherPlayer1.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        public static System.Drawing.Bitmap Pic_OtherPlayer2_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_OtherPlayer2.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        public static System.Drawing.Bitmap Pic_OtherPlayer3_Image {
            get {
                object obj = ResourceManager.GetObject("Pic_OtherPlayer3.Image", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
    }
}

Your files are messed up; it looks like to tried to convert half of a Resources class into a form.

Add a new Form by right-clicking the project and clicking Add, Windows Form (and give it an real name, not Form2 ) and move your code into it.
Then, delete all of the files involved in your current dysfunctional Form2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM