473,320 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using radio buttons to generate an int value for input into switch

I'm wanting to use radio buttons to generate an integer value to determine which option to take in a switch function.

I'm getting a warning (CS0219) The variable 'Radio' is assigned but its value is never used.

...


private void RadioP1_CheckedChanged(object sender, EventArgs e)
{
if (RadioP1.Checked == true) //give int output in order to give unique calculation
{
int Radio = 1;
}
else
TextP1.Text = " ";
}

...

private void Calculate_TextChanged(object sender, EventArgs e)
{
switch (Radio)
{
case 1:

Vol1 = float.Parse(TextVol1.Text);
U1 = float.Parse(TextU1.Text);
Vel1 = float.Parse(TextVel1.Text);
h1 = float.Parse(TextH1.Text);
Q = float.Parse(TextQ.Text);
P2 = float.Parse(TextP2.Text);
Vol2 = float.Parse(TextVol2.Text);
U2 = float.Parse(TextU2.Text);
Vel2 = float.Parse(TextVel2.Text);
h2 = float.Parse(TextH2.Text);
W = float.Parse(TextW.Text);

P1 = (((P2 * Vol2) + U2 + ((Vel2 * Vel2) / 2) + (g * h2) + W - Q - (g * h1) - ((Vel1 * Vel1) / 2) - U1) / Vol1);
TextP1.Text = P1.ToString();

break;
Mar 22 '17 #1
0 1057

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Newbie | last post by:
I currently have a set of simple calculations to determine square footage and multuply that by a dollar amount per foot. I use form fields that are filled in by the user, and then the Submit...
1
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there...
10
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
0
by: sanmateof | last post by:
My radio buttons are showing the value besides the button even though no text is displayed. Below is my code: <td style="width: 100px"><asp:RadioButtonList ID="RadioButtonList16" runat="server"...
6
by: shror | last post by:
i want to add a midi file to my pages and i want to put two radio buttons so that on is on and the other is off so that the users can start or stop the file playing by choosing one of the radio...
1
by: worldapps | last post by:
Hi, Can any one help me in my fallowing tasks. 1) I have Table po_headers in that i have two columns like po_number, po_type In my form Layout I have to take
3
by: Eric | last post by:
Hi. I have this Combobox name 'Origin' that contains all states and countries. I would like to create two Radio buttons (State and Country) that when you select State, the combobox will query only...
8
by: eeffoc | last post by:
I've got a set of six radio buttons inside of a list box and what I'm trying to accomplish is generate a random number all with different ranges (Dice for d&d) depending on what radio button is...
1
by: sreegans | last post by:
Hi.. I'm using 2 radio buttons in my form, for the user to select male or female.. How to insert this value into the database.... Any one pl help.. Sree.
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.