I have lots of comments, here are just a few:
1. I don't think Sensor.GetAnalogValue() is doing what you think it is doing, I fail to see how the current code could be useful. Maybe you should first add a comment explaining what the method is supposed to do, and only then compare the code with the written description.
2. I see two new Random() statements inside Sensor. They tell me you did not understand the matter that was handled in your earlier thread, two days ago.
This is what the Random class does:
- each NextValue() returns a value assumed to be random, however it is never random, it is pseudo-random, which means anyone knowing the internal code can predict the next value. The values returned are from a huge but fixed and circular list (not stored but calculated), and the only random thing about it is you can influence where in the list the sequence will start, that is what the "seed" does.
- If you provide the same seed to different Random instances, you get the same values returned.
- And if you don't, the .NET Random class will derive a seed from the current time with millisecond resolution. As creating a Random object takes much less than a millisecond, two consecutive new Random() will typically use the same seed.
Normally, the easy way to correctly use Random is by having only one of them, so make it a static field within your Sensor class.
3. If you already know what Properties are, you shouldn't have a method called GetSensId(). If properties still are in your future, then don't bother for now.
4. Having a lot of variables with almost identical names (sensVal#, analogSens#) in general indicates bad design; you should consider avoiding so many variables in the first place, and when you really need them all at the same time, then consider an aggregate, such as an Array. Doing so your code will turn out to be more concise, clearer, and less prone to typing errors.
5. A method that is intended to obtain some values, such as sampling(), normally should make those values available to the other methods and properties of the class; yours doesn't, it has type void, and the only thing coming out of it is a complex string going to the screen. There are many ways to provide values, the obvious one is by using a return statement (you could return an Array of floats, of a List of doubles, or whatever suits you); alternatives are "out" parameters (don't abuse those!), and in some cases class-level variables (not recommended here). I hope you notice how this fits well with the previous comment.
6. You should not export information through a GUI element (such as a TextBox), except towards the program user; a program that shows information to the user in one part of the code, and then tries to regain that information from the GUI is extremely bad design. You should rely on data structures, what the user sees should be an afterthought, and not an essential part of operation.
7. Over time you will learn to carefully choose identifier names;
GetAnalogValue() is good,
sampling() is not.