
Hello.
I'm working on a project, where my "form application" needs some values to my Trackbar.
The values can goes from 10.000 to 20.000, then I need to convert these values to only 100 tags, with a step of 10.
My maths is not that good, and that why I hope there is someone out there that could help me.
10.000 + 10.000 = "20.000" or "10.000". If it is "10.000", how am I then able to convert this to 100 tags, when it actually goes from minus 10.000 to plus 10.000 ?
I hope I explaned my question good enough.





Split it as 200.
200 * 100 = 20000 (10000 on Positive side and 10000 on Negative side)





The way to think of this is that you have to break this up into 100 equal "chunks". Another word for break here is divide, so you now know that you have to divide it up into 100 equal chunks. This leads to you having to divide 20000 into 100 equal chunks  so putting the symbol into the appropriate place, you end up with 20000 / 100.





Between 1 and 1 there are 3 values. Between 10000 and 10000 there are 20001 integer values. Am I right?
No more Mister Nice Guy... >: 






No, because you that only works if you were to include the number you were taking away from in the calculation. Between 1 and 1 (for instance), there are only 2 numbers  suppose you start from 1, then you add 1 to get 0 and add 1 again to get 1. You don't take the initial 1 into account. Now don't confuse the OP  he's already stated his maths isn't that good.





Okey. Let's say we got some values like this:
int min = 10;
int max = 20;
int result = 0;
int step = 0;
result = min + max;
step = result / 100;
midRange = result / 2;
result = 10;
step = 5;
midRange 2.5;
The problem is that from 10 to 20, there is 30 steps, right?
*This math should I have learned in my first school year _ lol.





Yes, there are 30 steps. The mistake you are making here is that you have step as an integer  which would come out as 0 here. Try changing it to a double or float and see what value you get then.





Oh, thats rigth, I cahnged it to double, and was then able to get a a precise value.
I think I get it from now on. thanx for all the help I got from all!






In line 6 you comment "// Getting the difference...", but the equation on the same line is adding. To get a difference, you have to subtract:
result = max  min;
Let's use values in this equation:
result = 20 (10);
result = 20 + 10;
result = 30;
Ciao,
luker
modified 8Nov12 9:41am.





You are proberly right about that, but if we need to get the how many steps there is form 10 to 10, then we have to plus?





<quote>we have to plus?
Actually we have to subtract: Steps = Max  Min
In case Min is less than zero, this evolves in a doulbeminus if we write the actual numbers down. But you don't have to worry about that if you leave the computation to a machine. Just tell it to "Max  Min" and it will take care of the sign on its own.
Question was for the step count. Number of possible positions is (stepCount + 1).
++++++++
3 2 1 0 1 2 3 4
stepCount = 4  (3) = 7
positionCount = stepCount + 1 = 8
Ciao,
luker





Would not be like range from 1000 to 1000?
With step of 1? That would be 2001 values not 100? Am i missing something?
No more Mister Nice Guy... >: 





Here's a little trick for you  open up Calc.exe and type in 1000020000. See what answer you get.





Equal 10000.
what is you point? I'm not getting it?





My point is that his calculation is wrong. Ignore it  between 10000 and 10000, there are only 20000 integers, not 20001.





I am not confusing anyone. It depends (forgive me if I am not using proper terminology) of range. Is this closed? Opened? From both or from one side? For example range <1,1> have 3 integers. Range <1,1) have 2 ints. (1,1> have 2 too. But (1,1) have only 0. Your substraction is range (10000,10000>. For me in this case you should either take closed from or opened from both range. But question is not clear about that som I can be wrong.
No more Mister Nice Guy... >: 





There are some different solutions and you have to decide.
There are 20001 values (in complete range) or having 20000 values (in reduced range 9999 to 10000)
In first case there should be 101 tags (10000, 9800, ..., 200, 0, +200, ..., +9800, +10000) (same interval, 200)
In second case you could use 100 tags (9999 to 9800, 9799 to 9600, ..., 199 to 0, 1 to 200, ... 9801 to 10000) (same blocksize, 200).
Otherwise the tags wouldn't have same size and same interval.

Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.





Hi, Im using Oracle database and I cant find the solution for SELECT,UPDATE,DELETE,INSERT query to access the ORACLE tables using VARIABLE in C# . .
Im using this Code and it dosnt work? what should I need to do? I think there is something wrong in (cmd.Parameters.Add) when I do assign VARIABLES.
con.Open();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO OUT_TEXT_NORM (KEY,LANG_ID,TEXT, PRIO) VALUES (:key,:lang_id,:text,:prio)";
cmd.Parameters.Add(":key", OracleDbType.Varchar2, 60).Value = key;
cmd.Parameters.Add(":lang_id", OracleDbType.Int32).Value = lang_id;
cmd.Parameters.Add(":text", OracleDbType.Varchar2, 4000).Value = text;
cmd.Parameters.Add(":prio", OracleDbType.Int32).Value = prio;
cmd.ExecuteNonQuery();





Are you getting an error of some type?
Can you explain what does not work.





It say's Invalid command for CMD





Try renaming the textcolumn; it's probably a reserved word.





Is there any other way in assinging variables?





Nope.
Still, I don't think the code is faulty; it's more likely to be the Sql command. A column named "TEXT" might be confusing to the parser.



