I'm trying to figure out why my "if" statements are being skipped over? Basically I set my pricing by a user selection in a combo box and it sets the price to calculate materials on.
I set up a few textboxs to output my varibles and my "userVinylCost" is being skipped over.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
// Form Varibles
Form2 f2 = new Form2();
// Price Varibles
double markupRate = 0;
double materialCost = 0; // Total Cost of App & Vinyl Material (not including markup)
double vinylCost = 0;
double tapeCost = 0;
double salePrice = 0;
//User Input Varibles
double userVinylCost;
double userAppCost = 0.0006;
string vinylType = "TR";
public Form1()
{
InitializeComponent();
}
public void btnCalculate_Click(object sender, EventArgs e)
{
VinylMaterialPricer();
}
private void Form1_Load(object sender, EventArgs e)
{
//txtSpecifyBox.Visible = true;
}
private void btnClear_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
private void btnClearAll_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
txtLength.Clear();
txtWidth.Clear();
}
public void VinylMaterialPricer()
{
if (cmbMatSelect.SelectedIndex == 1)
userVinylCost = 0.0030;
lblAppSetOutput.Text = "Oracal 651 Selected @ $25.00 \nfor 24 in X 10 yrd";
vinylType = "651";
if (cmbMatSelect.SelectedText == "751")
userVinylCost = 0.0060;
lblAppSetOutput.Text = "Oracal 751 Selected @ $50.00 \nfor 24 in X 10 yrd";
vinylType = "751";
if (cmbMatSelect.SelectedText == "951")
userVinylCost = 0.0090;
lblAppSetOutput.Text = "Oracal 951 Selected @ $??.00 \nfor 24 in X 10 yrd";
vinylType = "951";
if (cmbMatSelect.SelectedText == "OTHER")
vinylType = "Custom";
//txtSpecifyBox.Visible = true;
double widthValue = Convert.ToDouble(txtWidth.Text);
double lengthValue = Convert.ToDouble(txtLength.Text);
double sqinch = widthValue * lengthValue; // Total Sq Inches
if (rbRtaVinyl.Checked == true)
markupRate = 19.0;
if (rbMagnets.Checked == true)
markupRate = 39.0;
if (rbBanners.Checked == true)
markupRate = 59.0;
vinylCost = sqinch * userVinylCost; // Calucate Vinyl Per Sq In based on $25.00 Roll
tapeCost = sqinch * userAppCost; // Calculate App Tape Per Sq in base on $24.00/12" x 100yd roll
materialCost = vinylCost + tapeCost;
salePrice = (materialCost * markupRate) + materialCost;
textBox1.Text = Convert.ToString(vinylCost);
listBox1.Items.Add(String.Format("{0,-5} {1,8} {2,8} {3,8} ","Type", "Sq In ", "Material Cost ", "Sale Price"));
listBox1.Items.Add(String.Format("{0,-5} {1,8} {2,14:c2} {3,11:c2} ", vinylType, sqinch, materialCost, salePrice));
}
private void userSettingsToolStripMenuItem_Click(object sender, EventArgs e)
{
f2.Show();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
Thanks in advance for your help.
This post has been edited by 8100 Power: 17 October 2010 - 01:01 PM

New Topic/Question
Reply




MultiQuote







|