By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,337 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,337 IT Pros & Developers. It's quick & easy.

How to click a button multipal times

P: n/a
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
Feb 2 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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**********************************@microsof t.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

Feb 2 '07 #2

P: n/a
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**********************************@microsof t.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


Feb 2 '07 #3

P: n/a
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**********************************@microsof t.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



Feb 2 '07 #4

P: n/a
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**********************************@microsof t.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**********************************@microsof t.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


Feb 2 '07 #5

P: n/a
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



Feb 2 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.