Helps if you post the error.
From the code the value returned from Logic.Logic.Capture is being assigned
to slot 0 of the array and never any other slot? Are you just showing one
line of it?
Is Logic.Logic.Capture returning a double value?
Logic.Logic <--- very confusing have you got a Logic namespace and then a
class called Logic in it?
If it will always be 5 times that you do the capture and it will always be
done when someone clicks capture then something like this (this isn't
compileable code, but close to it, apply this methodology to youur app let
me know how you get on):
class myClass
{
double _weight;
int _slot;
double [] _weightsArry;
myClass()
{
_weight = 0;
_slot = 0;
_weightsArry = new double[5];
}
public void OnCaptureClick() //your click handler
{
if(slot < 5)
{
_weightsArry[slot] = theweightValue; //= to your captured
value
slot++;
}
}
public void Reset()
{
slot = 0;
//clear array here etc
}
public bool WithinTolerance()
{
//here you get your highest value and lowest value and work out
your range
//compare against tolerance and return true or false if it is
within tolerance
}
}
"thegreenone" <th*********@discussions.microsoft.comwrote in message
news:F1**********************************@microsof t.com...
ok i have the if,else if loop capture working. Now i have to create an
array
that will store the values so that i can compare the highest and lowest to
see if the are with in a tolarance.
private double [] allWeights = new double[5];
allWeights[0]=Logic.Logic.Capture()
""[1]"" and so on till [4]. i keep getting an error that does not like
when
i try and set it up this way. what am i doing wrong.
--
i have no experience be kind
"PokerMan" wrote:
>Looking at the code on a second click your member var will increment as i
expect you want it too, your string gets wiped and you do your
getweight() .
But you dont use that member variable anywhere? You just increment it?
So
it will do the same thing everytime you click it.
"thegreenone" <th*********@discussions.microsoft.comwrote in message
news:DA**********************************@microso ft.com...
private void button_Capture_Click(object sender, EventArgs e)
{
m_captureCount ++
this.txt.TestWeight1.Text = string.Empty;
try
{
BTScale.GetWeight(true);
}
catch (Exception ex)
{
system.windows.forms.messagebox.show(ex.Message);
}
this.txtTestWeight1.Text = BTscale.BTWeight;
}
right, so i can do the first capture and count increment but i dont
know
how to capture another click/tap event.
--
i have no experience be kind
"PokerMan" wrote:
This is a forum for advice and help. Not a "do my work for me please".
Have
a try and then post ur attempt if you are still stuck and people will
help
you correct your issues. That way you will learn something.
"thegreenone" <th*********@discussions.microsoft.comwrote in message
news:81**********************************@microso ft.com...
situation:
when i click capture button i need to capture a weight everytime i
hit
it
(5
fields to fill) pluse incriment a counter to let me know which field
to
fill.
I need a code skelaton.
--
i have no experience be kind