Using Using Using Using Using Using Using Using Using Namespace Public Partial Class
Using Using Using Using Using Using Using Using Using Namespace Public Partial Class
Using Using Using Using Using Using Using Using Using Namespace Public Partial Class
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace menustrip_demo
{
public partial class Form1 : Form
{
String s;
public Form1()
{
InitializeComponent();
}
tb = new TextBox();
this.Controls.Add(tb);
lb = new Label();
this.Controls.Add(lb);
16:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace base_mdi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Output:
19:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Web.config
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>
Default.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Label1.ForeColor != System.Drawing.Color.Red)
{
Label1.ForeColor = System.Drawing.Color.Red;
}
else
{
Label1.ForeColor = System.Drawing.Color.Yellow;
}
}
}
Output:
21:
Web.config
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
Webform1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="enable_disable_textbox.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Webform1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace enable_disable_textbox
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Enabled = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Button1.Text == "Enable")
{
Button1.Text = "Disable";
TextBox1.Enabled = true;
TextBox1.Width = 500;
}
else {
Button1.Text = "Enable";
TextBox1.Enabled = false;
TextBox1.Width = 100;
}
}
}
}
Output: