Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need some help...

I'm a C# noob...Any help would be appreciated:

// used only to populate the combo box, but you could use for determining
// angle to pass to the load factor function
private int[] mintAngleOfBank = {0, 10, 30, 45, 60, 70, 80, 85, 90};

// mdecLoadFactor array
private decimal[] mdecLoadFactor = {1.0M, 1.015M, 1.154M, 1.414M, 2, 2.923M, 5.747M, 11.473M, 9999};

private void frmLoadFactorCalculator_Load(
object sender, System.EventArgs e)
{
this.cboAngle.DataSource = mintAngleOfBank;
}


private void btnCalculate_Click(
object sender, System.EventArgs e)
{
// delcare variable
int intWeight = 0;
decimal decWeightImposed = 0;

// call LoadFactor function



}

private decimal LoadFactor(decimal mdecLoadFactor)
{
return (decimal) mdecLoadFactor;
}



How can I get the values in mintAngleOfBank = {0, 10, 30, 45, 60, 70, 80, 85, 90};
to relate to private decimal[] mdecLoadFactor = {1.0M, 1.015M, 1.154M, 1.414M, 2, 2.923M, 5.747M, 11.473M, 9999};

In the combobox, if I hit 0, 1.0 should display in a label and so forth.....

Any suggestions?

Thx

Comments

  • Martin626Martin626 Member Posts: 6
    : I'm a C# noob...Any help would be appreciated:
    :
    : // used only to populate the combo box, but you could use for determining
    : // angle to pass to the load factor function
    : private int[] mintAngleOfBank = {0, 10, 30, 45, 60, 70, 80, 85, 90};
    :
    : // mdecLoadFactor array
    : private decimal[] mdecLoadFactor = {1.0M, 1.015M, 1.154M, 1.414M, 2, 2.923M, 5.747M, 11.473M, 9999};
    :
    : private void frmLoadFactorCalculator_Load(
    : object sender, System.EventArgs e)
    : {
    : this.cboAngle.DataSource = mintAngleOfBank;
    : }
    :
    :
    : private void btnCalculate_Click(
    : object sender, System.EventArgs e)
    : {
    : // delcare variable
    : int intWeight = 0;
    : decimal decWeightImposed = 0;
    :
    : // call LoadFactor function
    :
    :
    :
    : }
    :
    : private decimal LoadFactor(decimal mdecLoadFactor)
    : {
    : return (decimal) mdecLoadFactor;
    : }
    :
    :
    :
    : How can I get the values in mintAngleOfBank = {0, 10, 30, 45, 60, 70, 80, 85, 90};
    : to relate to private decimal[] mdecLoadFactor = {1.0M, 1.015M, 1.154M, 1.414M, 2, 2.923M, 5.747M, 11.473M, 9999};
    :
    : In the combobox, if I hit 0, 1.0 should display in a label and so forth.....
    :
    : Any suggestions?
    :
    : Thx
    :

    All you need to do is to look for SelectedIndexChanged in the Events part of the combobox [ cboAngle] properties, create a label.

    Then copy everything down as shown below.

    void cboAngleSelectedIndexChanged(object sender, System.EventArgs e)
    {

    this.label1.Text = "LoadFactor :- " +
    mdecLoadFactor [this.cboAngle.SelectedIndex].ToString();
    }


    void btnCalculateClick(object sender, System.EventArgs e)
    {
    // declare variables
    int intWeight = 0;
    decimal decWeightImposed = 0;

    // call LoadFactor function
    LoadFactor(mdecLoadFactor[this.cboAngle.SelectedIndex];


    private decimal LoadFactor(decimal mdecLoadFactor)
    {
    return (decimal) mdecLoadFactor;
    }

    if there is still anything you are not sure of please get in touch with me again.

    Martin626
Sign In or Register to comment.