TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
selvi subramanian
NA
799
574.5k
what error in this please clear this error
Apr 29 2014 3:04 AM
i need to use if condition
in else if condition it throw error like
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:
CS0103: The name 'c' does not exist in the current context
Source Error:
Line 83: } Line 84:
Line 85: else if (c != 0)
Line 86: { Line 87: int c = int.Parse(TextBox3.Text) + int.Parse(TextBox4.Text);
Source File:
d:\sample tools\retrievedata\Default.aspx.cs
Line:
85
Show Detailed Compiler Output:
Show Complete Compilation Source:
my design
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Purchase"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Sales"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Return"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox4" runat="server" ontextchanged="TextBox4_TextChanged" AutoPostBack="true"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="Balance"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
<%-- <tr>
<td>
</td>
<td>
</td>
</tr>--%>
<tr>
<td colspan="2">
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="Button2" runat="server" Text="Clear" onclick="Button2_Click" />
</td>
</tr>
</table>
<%-- <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>--%>
</div>
</form>
</body>
</html>
my coding
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int a = int.Parse(TextBox1.Text);
int b = int.Parse(TextBox2.Text);
// int c = int.Parse(TextBox3.Text);
if (a == b)
{
int c = int.Parse(TextBox1.Text) - int.Parse(TextBox2.Text);
TextBox3.Text = Convert.ToString(c);
//Label1.Text = "balance is nill";
}
else if (a >= b)
{
int c = int.Parse(TextBox1.Text) - int.Parse(TextBox2.Text);
TextBox3.Text = Convert.ToString(c);
}
else if (a <= b)
{
// Label1.Text = "Stock is over";
int c = int.Parse(TextBox1.Text) - int.Parse(TextBox2.Text);
TextBox3.Text = Convert.ToString(c);
}
}
protected void TextBox4_TextChanged(object sender, EventArgs e)
{
int a = int.Parse(TextBox1.Text);
int b = int.Parse(TextBox2.Text);
// int c = int.Parse(TextBox3.Text);
if (a == b)
{
int c = int.Parse(TextBox1.Text) - int.Parse(TextBox2.Text);
c= int.Parse(TextBox3.Text) - int.Parse(TextBox4.Text);
TextBox3.Text = Convert.ToString(c);
//Label1.Text = "balance is nill";
}
else if (c != 0)
{
int c = int.Parse(TextBox3.Text) + int.Parse(TextBox4.Text);
TextBox3.Text = Convert.ToString(c);
}
Reply
Answers (
5
)
12 hrs timepicker in ASP.net
Crystal Reports in Visual studio 2012 using MVC 4