1
Answer

Compilation Error

Photo of Neven Huynh

Neven Huynh

15y
2.7k
1
i got this message error when i publish and run my web although i already built and run it successfully in visual studio 2005 . somebody help me. thank in advance.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'Products' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\savipublish\669c962b\ff3d3118\assembly\dl3\841b1c6d\98d81aa4_239fca01\App_Web_rrthse2q.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\savipublish\669c962b\ff3d3118\assembly\dl3\1a97c8a4\5e43ba97_239fca01\App_Code.DLL'

Source Error:


Line 110:    
Line 111: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 112: public class products_aspx : global::Products, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Line 113:
Line 114: private static bool @__initialized;

Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\savipublish\669c962b\ff3d3118\App_Web_products.aspx.cdcab7d2.xzpjxyhw.0.cs    Line: 112

Answers (1)

0
Photo of Kirtan Patel
NA 35k 2.8m 15y
sorry Dear there are some Correction in code


try below code now it will work


private void button1_Click(object sender, EventArgs e)

        {

            Form2 f2 = new Form2();

            f2.MdiParent= this;

            f2.StartPosition = FormStartPosition.CenterScreen;

            f2.Show();

        }


Accepted
0
Photo of Kirtan Patel
NA 35k 2.8m 15y
Hi


Make MDIFroms
KeyPreview Property to True

then  here Is Code For key press Event of MDI Form Now it will Open Form2 When i Press ' A' From keyboard ( Shift+A) key

  private void Form1_KeyPress(object sender, KeyPressEventArgs e)

        {


            if (e.KeyChar == (char)(65))

            {

                Form2 f2 = new Form2();

                f2.MdiParent = this;

                f2.StartPosition = FormStartPosition.CenterScreen;

                f2.Show();

            }

        }


0
Photo of garuka
NA 26 0 15y

Hi Kirtan,
Sweet. It's working. I think issue No1 is solved now.

But any idea about issue two? Do I have to handle this in from level instead of MDI level?
0
Photo of garuka
NA 26 0 15y

Hi Kirtan,
There is a problem in that approach which I already tried. The problem is related to part 1. My Login form loads when the MDI is loading. So when I add that code segment I get the error "Top-level control cannot be added to a control."

About the second part..the problem that child window is loaded from MDI window. the MDI should listern to key board and load the window in the middle of currently focused form inside MDI.

So I'm sorry I don't think that suggestion will work.
0
Photo of Kirtan Patel
NA 35k 2.8m 15y
Hi Garuka ,

here is solution for your Problem



you can Do it By Both Way By Code  and Setting Property

 Just Setting StartPositon Propety of Form  to "CenterScreen" of Which you trying to show in MDI form


or By Coding You can do it Like below Code


private void button1_Click(object sender, EventArgs e)

        {

            Form2 f2 = new Form2();

            f2.Parent = this;

            f2.StartPosition = FormStartPosition.CenterScreen;

            f2.Show();

        }