Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. unable to use <%@ import Namespace="System.Windows.Forms" %>

unable to use <%@ import Namespace="System.Windows.Forms" %>

Scheduled Pinned Locked Moved ASP.NET
helpcsharptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    myohanna
    wrote on last edited by
    #1

    Hi, i use this code for web development and create message box: <%@ Control Language="C#" Src="nsoftwareAS2.cs"%> <%@ import Namespace="nsoftwareAS2" %> <%@ import Namespace="System" %> <%@ import Namespace="System.Windows.Forms" %> but it shows an error message when i tried to run the site: CS0234: The type or namespace name 'Windows' does not exist in the class or namespace 'System' (are you missing an assembly reference?) How to fix it? MY

    S 1 Reply Last reply
    0
    • M myohanna

      Hi, i use this code for web development and create message box: <%@ Control Language="C#" Src="nsoftwareAS2.cs"%> <%@ import Namespace="nsoftwareAS2" %> <%@ import Namespace="System" %> <%@ import Namespace="System.Windows.Forms" %> but it shows an error message when i tried to run the site: CS0234: The type or namespace name 'Windows' does not exist in the class or namespace 'System' (are you missing an assembly reference?) How to fix it? MY

      S Offline
      S Offline
      sstocker
      wrote on last edited by
      #2

      You are writing an ASP.Net application which CANNOT use the System.Windows namespace. To create a messagebox you can simply use javascript. Here is an example: StringBuilder str = new StringBuilder(); str.Append(""); str.Append("alert('Your Message Here')"); str.Append(""); RegisterStartupScript("Msg",str.ToString()); Hope that helps. Scott Stocker

      S M 2 Replies Last reply
      0
      • S sstocker

        You are writing an ASP.Net application which CANNOT use the System.Windows namespace. To create a messagebox you can simply use javascript. Here is an example: StringBuilder str = new StringBuilder(); str.Append(""); str.Append("alert('Your Message Here')"); str.Append(""); RegisterStartupScript("Msg",str.ToString()); Hope that helps. Scott Stocker

        S Offline
        S Offline
        sstocker
        wrote on last edited by
        #3

        Also note that you can replace the "alert" in the above example with "confirm" to display a messagebox with an ok and cancel button (in the instance that in your messagebox you want the user to confirm an action). Scott Stocker

        1 Reply Last reply
        0
        • S sstocker

          You are writing an ASP.Net application which CANNOT use the System.Windows namespace. To create a messagebox you can simply use javascript. Here is an example: StringBuilder str = new StringBuilder(); str.Append(""); str.Append("alert('Your Message Here')"); str.Append(""); RegisterStartupScript("Msg",str.ToString()); Hope that helps. Scott Stocker

          M Offline
          M Offline
          myohanna
          wrote on last edited by
          #4

          I tried use your code and it gave me error message: CS1010: Newline in constant Source Error: Line 185: str.Append(""); I think the error came because I tried to use it inside my C# script: if (Common.RemoveSpecialCharacters(txtOrg.Text).Equals("")) { StringBuilder str = new StringBuilder(); str.Append(""); str.Append("alert('Please enter a valid organization name.')"); str.Append(""); RegisterStartupScript("Msg",str.ToString()); //lError.Text = "Please enter a valid organization name."; //return; } Any more help please? Thanks MY

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups