- Details
- Category: Visual Studio Notes
- Hits: 1024
{tab iisexpress error}
{tab Starting My First Web App}
{tab My First Web App}
{tab Visual Studio Notes}
{/tabs}
Problem Error iisexpress.exe
The program '[7980] iisexpress.exe' has exited with code 0
Solution
Delete .vs folder from the project, then it ran OK.
- Details
- Category: Visual Studio Notes
- Hits: 972
{tab iisexpress error}
{tab Starting My First Web App}
{tab My First Web App}
{tab Visual Studio Notes}
{/tabs}
- Start Menu:
- New Project or file new Porject:
- Template:
- Visual C#:
- Web:
- ASP.NET Web Application
- Name: MyFirstWebApp (no spaces)
- Click OK:
- ASP.NET Templates
- click on Empty:
- Add Folder and core references for:
- Check Web Forms:
- Click OK button:
- Solution Explorer
- right click on Project Name
- Click on Add:
- Click on Web Form
- Specify Name for Item
- type Default:
- Click on OK:
- It will create page Dafault.aspx:
- Details
- Category: Visual Studio Notes
- Hits: 1101
{tab iisexpress error}
{tab Starting My First Web App}
{tab My First Web App}
{tab Visual Studio Notes}
{/tabs}
- type What is your first name? (Double space space):
- in Toolbox double click on TextBox:
- use arrow key to go to end of TexBox:
- press enter key twice:
- type What is your last name? (Double space space):
- in Toolbox double click on TextBox:
- use arrow key to go to end of TexBox:
- press enter key twice:
- in Toolbox double click to insert Botton:
- use arrow key to go to end of Botton:
- press enter key twice:
- in Toolbox double click to insert Label:
- Select first TextBox:
- goto Properties Box (lower right hand side):
- find (ID): Type, firstNameTextBox:
- hit Enter key:
- Select second TextBox:
- goto Properties Box (lower right hand side):
- find (ID): Type, lastNameTextBox:
- hit Entere key:
- Select Botton control:
- goto Properties box:
- find (ID): Type, OkButton:
- Under Appearance category:
- find Text: Type, Click Me:
- hit Enter key:
- Select Label conrol:
- Under Misc category:
- find (ID): Type, resultLabel
- Under Appearance category:
- find Text: in textbox delete Lablel to remove the text:
- hit Enter key:
- Double click, Click Me Botton:
- It will open a new file called: Default.aspx.cs
- Make sure curse in inside: protected void OkButton_Click(object sender, EventArgs e)
- inside the the curley braces type :
{
string firstName = firstNameTextBox.Text;
string lastName = lastNameTextBox.Text;
string result = "Hello " + firstName + " " + lastName;
resultLabel.Text = result;
}
- Save your work:
- Now Run your work:
- Click the Green Arrow
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MyFirstWebApp.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form2" runat="server">
<div>
What is your first name?
<asp:TextBox ID="firstNameTextBox" runat="server"></asp:TextBox>
<br />
<br />
What is your last name?
<asp:TextBox ID="lastNameTextBox" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="OkButton" runat="server" OnClick="OkButton_Click" Text="Click Me" />
<br />
<br />
<asp:Label ID="resultLabel" runat="server"></asp:Label>
</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;
namespace MyFirstWebApp
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void OkButton_Click(object sender, EventArgs e)
{
string firstName = firstNameTextBox.Text;
string lastName = lastNameTextBox.Text;
string result = "Hello " + firstName + " " + lastName;
resultLabel.Text = result;
}
}
}