Click here to Skip to main content
16,015,504 members
Articles / Programming Languages / C#
Article

Ohm's Problem

Rate me:
Please Sign up or sign in to vote.
1.11/5 (15 votes)
20 Aug 20041 min read 47K   291   7   5
This article brings up the old law that no one seems to talk about, or know about. It solves some problems that came up while developing this program.

Image 1

 

 

 

 

 

 

 

 

Introduction

I have been interested in making electronic components not just for the computer but for the everyday life and self entertainment. I wanted to make all the calculations from ohm's law into a simple program that will enable quick calculations while using the .net framework v.2.0 and in the process using a new language: C#, normally I use C++ but I wanted to switch to the newest technologies out so far. Anyways I have found alot about computer programming like an interesting fact is that the .net framework makes every language the same except the syntax and thats it.

The 'IsNumeric' Problem

I have found out that the .net framework v.2.0 still doesn't have all the features a programmer would like to have like an 'IsNumeric' function, which I used to validate the input. Kind of like the STL for C++, it had all those kinds of goodies like, 'IsAlpha' 'IsAlphanumeric' and my favorite 'IsNumeric' ;-). Anyways I got around this problem by making the following function:

C#
private bool IsNumeric(object value)

{

try

{

UInt32 d = System.UInt32.Parse(value.ToString(),

System.Globalization.NumberStyles.Any);

return true;

}

catch

{

return false;

}

}

This function takes in one parameter of type object and returns true if the parameter is numeric and false if it isn't.

Ohm's Law

I have implemented the whole law in this program which includes basic equations but accurate answers. You can find the eqations in the link provided:  http://www.xteradesign.com/xds/ohms-law.htm

Conclusion

I hope this article helps everyone and I have added a nice GUI to the program, nothing special though, played around with the colors until I was appealed, anyways thanks for the time and don't forget to vote :b.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 1 Pin
mattiassundstrom1-Oct-09 23:53
mattiassundstrom1-Oct-09 23:53 
GeneralWhy not use tryparse Pin
morphix23-Aug-04 2:20
morphix23-Aug-04 2:20 
GeneralIsNumeric Pin
Marc Clifton22-Aug-04 11:35
mvaMarc Clifton22-Aug-04 11:35 
GeneralI have never had a problem with Ohm Pin
leppie22-Aug-04 4:05
leppie22-Aug-04 4:05 
Even my 50 cent calculator has division... or do you mean to say Ohm had a problem or he actually had a problem with .NET ?

top secret xacc-ide 0.0.1
GeneralRe: I have never had a problem with Ohm Pin
Anonymous24-Aug-04 12:22
Anonymous24-Aug-04 12:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.