Ok. I am not a programmer and am in school for this (yeah, yeah, at my age..I know).
I do not have a c# book and it's an online class and the instructor does not go that far into detail. example for this homework was all done in "text" and no numbers..integers...etc.
i have had to figure this much out on my own. Not very good anyway.
could anyone help me to find what is wrong with this code? I can't covert the last line..or the lblResults box. It's a simple calculator. I have had one VB class but I don't think it's helping.
Thanks in advance
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Collections.Generic;
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)
{
//this is the time
lblOut.Text = DateTime.Now.ToString();
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
//Setting the text to the stxt box by default
string sText = "";
sText = lblResults.Text;
//Checking for a length in the name box
if (txtBoxName.Text.Length == 0)
{
lblResults.Text = "Enter Your Name";
return;
}
if (txtBoxEarnings.Text.Length == 0)
{
lblResults.Text = "Please enter Your Earnings";
return;
}
if (txtBoxHealth.Text.Length == 0)
{
lblResults.Text = "Please enter your Health Deductions";
return;
}
if (txtBox401K.Text.Length == 0)
{
lblResults.Text = "Please enter your 410k deduction";
return;
}
//setting the values of radio buttons.
{ int rad1 = 8;
int rad2 = 52;
int rad3 = 12;
string sResult;
if (rdoInterval1.Checked == true)
sResult = "txtBoxEarnings.Text * rad1";
else if (rdoInterval2.Checked == true)
sResult = "txtBoxEarnings.Text * rad2";
else if (rdoInterval3.Checked == true)
sResult = "txtBoxEarnings.Text * rad3";
else
lblResults.Text = "please select a button";
// trying to add the health and 401k together
int fourK = 12;
int Health = 12;
string strEarnings;
string strHealth;
string str401k;
strHealth = "txtBoxHealth.Text * Health";
str401k = "txtBox401K.Text * fourK";
strEarnings = "txtBoxEarnings.Text";
// getting the results
lblResults = Convert.ToInt32("strEarnings + sResult + strHealth + str401k");
}
}
}
Nothing is stopping you from continuing with your testing cadence.
If updates are released every 2 weeks instead of 4, and you test once every 4 weeks, the exact same amount of patches will still be available for you in those 4 weeks.
For example:
Before
4th week - patch 1, 2, 3, 4
After
2nd week - patch 1 and 2
4th week - patch 3 and 4
Still the same amount after 4.
Everyone else has said it. I'm gonna say it - you don't know what you're talking about.
I do. I have two laptops. One work, one personal. I have access to two more laptops - both personal. At home I manually update my personal laptop when I see on Neowin that there is an update - I carry on and only apply the updates when I am ready. My work one only updates when my workplace decides to send it - I carry on and only apply the updates (when they actually arrive, which is usually days after the release) when I switch off the laptop at the end of the day as usual. The two other personal laptops only get updated when I get to it which is rarely - the people who own them carry on using them until I get to it and update them.
All of the browsers on all laptops are configured to restore the tabs when launched.
Google and Microsoft have changed from 6 weeks to 4, and it looks like it's going to move to 2. None of these changes affect how any of these browsers on the laptops are used. Not one jot.
My advice to you is stop panicking whenever you see an update. Just carry on with what you're doing. This even benefits you in a way - from your comment you sound like you don't like the changes or the frivolous new features - great - then carry on as before!
Question
The Grasshopper
Ok. I am not a programmer and am in school for this (yeah, yeah, at my age..I know).
I do not have a c# book and it's an online class and the instructor does not go that far into detail. example for this homework was all done in "text" and no numbers..integers...etc.
i have had to figure this much out on my own. Not very good anyway.
could anyone help me to find what is wrong with this code? I can't covert the last line..or the lblResults box. It's a simple calculator. I have had one VB class but I don't think it's helping.
Thanks in advance
using System; using System.Configuration; using System.Data; using System.Linq; using System.Collections.Generic; 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) { //this is the time lblOut.Text = DateTime.Now.ToString(); } protected void btnSubmit_Click(object sender, EventArgs e) { //Setting the text to the stxt box by default string sText = ""; sText = lblResults.Text; //Checking for a length in the name box if (txtBoxName.Text.Length == 0) { lblResults.Text = "Enter Your Name"; return; } if (txtBoxEarnings.Text.Length == 0) { lblResults.Text = "Please enter Your Earnings"; return; } if (txtBoxHealth.Text.Length == 0) { lblResults.Text = "Please enter your Health Deductions"; return; } if (txtBox401K.Text.Length == 0) { lblResults.Text = "Please enter your 410k deduction"; return; } //setting the values of radio buttons. { int rad1 = 8; int rad2 = 52; int rad3 = 12; string sResult; if (rdoInterval1.Checked == true) sResult = "txtBoxEarnings.Text * rad1"; else if (rdoInterval2.Checked == true) sResult = "txtBoxEarnings.Text * rad2"; else if (rdoInterval3.Checked == true) sResult = "txtBoxEarnings.Text * rad3"; else lblResults.Text = "please select a button"; // trying to add the health and 401k together int fourK = 12; int Health = 12; string strEarnings; string strHealth; string str401k; strHealth = "txtBoxHealth.Text * Health"; str401k = "txtBox401K.Text * fourK"; strEarnings = "txtBoxEarnings.Text"; // getting the results lblResults = Convert.ToInt32("strEarnings + sResult + strHealth + str401k"); } } }Link to comment
https://www.neowin.net/forum/topic/700700-c-coding-problem/Share on other sites
22 answers to this question
Recommended Posts