C# Calculating A Series Connection
Posted 15 August 2005 - 05:18 AM
im trying to make an application, that calculates the different values of a series connection, like Volt,Ampere,Ohm and the single values.
it should be like this:
i have a form with lots of textboxes in it. the user can choose how many resistors (e.g. LEDs) he wants to have (max. 5).
if he has choosen 5 resistors, there are 13 textboxes.
(sorry, my translation for the terms isn't very good)
whole volt,whole ampere,whole ohm
and then 2 textboxes (volt and ohm, as ampere is everywhere the same) per resistor.
all textboxes are set to "0" by default. the user can define an amount of values and click calculate.
now it comes to my problem. it seems to be too much for my small brain to implement all dependencies. i have tried several times (i have spent 2 days on that crap til now) but it doesnt work. too complex
andy have an idea about how to solve my problem?
Posted 15 August 2005 - 07:17 AM
Why not create the maxium number of textboxes on the form in the positions you want them to be. Set them all by default to "Visible = false;", "Text = "0";. Then based on an event (5 resistors choosen) make the necessary textboxes visible and then calculate whateva it is you need to calc.
Sorry if thats not even close to what your asking but thats how I understood what you were asking for.
Posted 15 August 2005 - 07:32 AM
you know the different values have different dependencies, dont u ?
U1/U2 = R1/R2
the problem is, that i dont know what values the user has defined. so i have to if/else me through every possible opportunitie, which i can't handle.
Posted 15 August 2005 - 09:30 AM
Posted 15 August 2005 - 10:00 AM
u know like an excercise from a science book. it goes something like this:
"We have 3 resistors connected in series. the amperage of the connection is 0,15 A. the resistance of resistor 1 is 100 ohm. the voltage of resistor 2 is 4,5 V. the voltage of the whole connections is 15 volt. calculate the missing values".
everything my program has to do is solve this excercise,where the excercise/predefined values are given by the user.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users