473,411 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

How to click a button multipal times

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
5 1542
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: eltronic | last post by:
here is some code to add right click context menus. in the few apps I've edited sofar, it just works, once you run rCbinder with the root of the gui or bind B3 all present and future widgets will...
21
by: news.btinternnet.com | last post by:
I can do this in IE myLink.click(); //Invoking the handler as if the user had clicked on the link themselves. I need to be able to do the same in Netscape Navigator, can anyone help ?
2
by: Josh Armstrong | last post by:
I have a form with 4 text boxes; the data that is entered into them are as follows. Text1= Start Time Text2= End Time Text3= Date Text4= Interval I need the form to populate a table with...
3
by: Max Khitrov | last post by:
Hello everyone, I ran into a small problem here and just can't figure it out. I'm writing a VS .NET add-in which creates a new commandbar and populates it with a few buttons. Each button is...
16
by: Barry Gilmore | last post by:
Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!
1
by: Drew | last post by:
I would like to find out how to build a click counter using VB.NET. This is not a run-of-the-mill click counter (i.e. for web use), but a novelty app that counts how many times you click...
21
by: Ben | last post by:
Hello I have frames set up in an asp.net application and need one frame to refresh another. Seeing as events need to be registered at the time the page is sent from the server, I was wondering...
2
by: ImageAnalyst | last post by:
Does anyone know how to get rid of excess mouse clicks? I have a button that does some code which takes some time to execute. As soon as the user clicks the button, I disable the button in the...
2
by: =?Utf-8?B?SGV6YWw=?= | last post by:
Hi, I am trying to add a new record to a table but everytime I click the button, somehow it saves the record twice... I've created a stored procedure to insert records into a table and I called...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.