vb.net windows application code to c#,asp.net web application code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manjitsarma
    New Member
    • Jul 2007
    • 34

    vb.net windows application code to c#,asp.net web application code

    I have changed the following original vb.net window application code

    Code:
    Public Overrides Function SetTheme(ByRef frmObj As 
    System.Windows.Forms) As Boolean
    into c#.net as-

    Code:
    public override bool SetTheme(ref System.Windows.Forms frmObj)
    ..

    Later on changed to

    Code:
    public override bool SetTheme(ref System.Web.UI.Page frmObj)
    .....since it is to be used in ASP.NET web application(web form).

    Then I m getting errors in following code

    Code:
    frmObj.TransparencyKey = this.TransperncyColor;
    Error:System.Web.UI. Page does not contain definition for
    TransparencyKey

    Code:
    frmObj.BackgroundImage.FromFile(this.BackGroundImage)
    Error :System.Web.UI. Page does not contain definition for
    BackgroundImage .

    Again getting errors in following code.

    Code:
    foreach (Control cntl in  frmObj.Controls)
       {
    			
                if ((cntl) is DropDownList)
                {
    	cntl.ForeColor = Color.Red;
    
                }
               else
               {
    	cntl.ForeColor = Color.Black;
               }
    
        }
    Error:System.Web.UI. Control does not contain definition for Forecolor.

    I have used namespace 'using System.Drawing' .

    How to debug it ?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by manjitsarma
    I have changed the following original vb.net window application code

    Code:
    Public Overrides Function SetTheme(ByRef frmObj As 
    System.Windows.Forms) As Boolean
    into c#.net as-

    Code:
    public override bool SetTheme(ref System.Windows.Forms frmObj)
    ..

    Later on changed to

    Code:
    public override bool SetTheme(ref System.Web.UI.Page frmObj)
    .....since it is to be used in ASP.NET web application(web form).

    Then I m getting errors in following code

    Code:
    frmObj.TransparencyKey = this.TransperncyColor;
    Error:System.Web.UI. Page does not contain definition for
    TransparencyKey

    Code:
    frmObj.BackgroundImage.FromFile(this.BackGroundImage)
    Error :System.Web.UI. Page does not contain definition for
    BackgroundImage .

    Again getting errors in following code.

    Code:
    foreach (Control cntl in  frmObj.Controls)
       {
    			
                if ((cntl) is DropDownList)
                {
    	cntl.ForeColor = Color.Red;
    
                }
               else
               {
    	cntl.ForeColor = Color.Black;
               }
    
        }
    Error:System.Web.UI. Control does not contain definition for Forecolor.

    I have used namespace 'using System.Drawing' .

    How to debug it ?
    Moved from the Java(!) to the .NET forum.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      All of those are specific to windows application controls. Just remove them.

      Comment

      • manjitsarma
        New Member
        • Jul 2007
        • 34

        #4
        But I need to use them in web application.so could you tell me what are the other ways I can approach ? and is it the correct way to convert-

        Code:
        public override bool SetTheme(ref System.Windows.Forms frmObj)
        into-
        Code:
        public override bool SetTheme(ref System.Web.UI.Page frmObj)
        ...to use in ASP.NET web application.Is it for this conversion,I am getting the errors ?





        Originally posted by Plater
        All of those are specific to windows application controls. Just remove them.

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          But they are no longer applicable. Like the concept of themes is a windows only thing (determines if your program looks like windows2000 or winxp)

          And another one was setting a transparency color on the form. That is done with CSS not backend code.

          You should be looking up the individual commands to see if they even apply to a web-based application

          Comment

          • manjitsarma
            New Member
            • Jul 2007
            • 34

            #6
            ok.Thanks for the suggestion :)

            Comment

            Working...