Government Security
Network Security Resources

Jump to content

Photo

C# Calculating A Series Connection

- - - - - c#
  • Please log in to reply
4 replies to this topic

#1 usch

usch

    Staff Sergeant

  • Sergeant Major
  • 269 posts

Posted 15 August 2005 - 05:18 AM

hi guys

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?

thanks
usch

#2 IcedOut3E

IcedOut3E

    Corporal

  • Members
  • 154 posts

Posted 15 August 2005 - 07:17 AM

I'm a little bit confused with what your trying to do but I'll give it a shot.

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.

#3 usch

usch

    Staff Sergeant

  • Sergeant Major
  • 269 posts

Posted 15 August 2005 - 07:32 AM

i`'m sorry, it seems that i have not made myaelf clear enough. dynamically adding textboxes is no problem.

you know the different values have different dependencies, dont u ?

U:volt
r:ohm
i.amper

U=R*I

Uwhole=U1+U2...
Rwhole=R1+R2...
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.

usch

#4 IcedOut3E

IcedOut3E

    Corporal

  • Members
  • 154 posts

Posted 15 August 2005 - 09:30 AM

I'm sorry, I still don't understand bro. Sorry...I guess I tried.

#5 usch

usch

    Staff Sergeant

  • Sergeant Major
  • 269 posts

Posted 15 August 2005 - 10:00 AM

ok last try ;)
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.

usch





Also tagged with one or more of these keywords: c#