In my program I have several labels that I want to update with
information that is being processed in a calculation module. I have
code similar to the following in my module. As it goes through its
process, I would like to show an update to the counts that are being
generated to show progress.
Code in a module........
cntClasses = cntClasses + 1
cntTrials = cntTrials + 3
Form1.lblCntClasses.Text = Format(cntClasses, "###,###")
Form1.lblCntTrials.Text = Format(cntTrials, "###,###")
End Code.......
I get errors on the "Form1.lbl......" statements which says "Reference
to a non-shared member requires an object reference.".
How do I rectify this? Do I have to refresh Form1 again?
Code examples or suggestions?
Sorry for the newbie questions.
Hexman 7 2922
Hexman wrote: In my program I have several labels that I want to update with information that is being processed in a calculation module. I have code similar to the following in my module. As it goes through its process, I would like to show an update to the counts that are being generated to show progress.
Code in a module........ cntClasses = cntClasses + 1 cntTrials = cntTrials + 3
Form1.lblCntClasses.Text = Format(cntClasses, "###,###") Form1.lblCntTrials.Text = Format(cntTrials, "###,###")
End Code.......
I get errors on the "Form1.lbl......" statements which says "Reference to a non-shared member requires an object reference.".
How do I rectify this? Do I have to refresh Form1 again?
Code examples or suggestions?
Sorry for the newbie questions.
Hexman
you either have to pass a reference to the form and make a property to
edit it, or pass the label into the module.
chris
On Mon, 28 Nov 2005 22:40:28 -0500, I Don't Like Spam <no@spam.com>
wrote: Hexman wrote: In my program I have several labels that I want to update with information that is being processed in a calculation module. I have code similar to the following in my module. As it goes through its process, I would like to show an update to the counts that are being generated to show progress.
Code in a module........ cntClasses = cntClasses + 1 cntTrials = cntTrials + 3
Form1.lblCntClasses.Text = Format(cntClasses, "###,###") Form1.lblCntTrials.Text = Format(cntTrials, "###,###")
End Code.......
I get errors on the "Form1.lbl......" statements which says "Reference to a non-shared member requires an object reference.".
How do I rectify this? Do I have to refresh Form1 again?
Code examples or suggestions?
Sorry for the newbie questions.
Hexman
you either have to pass a reference to the form and make a property to edit it, or pass the label into the module.
chris
Currently I have 6 labels that I want updated on the form, with more
to come. Any preference to either of the methods you mentioned? Any
code snippet of either?
Thanks,
Hexman
Hexman wrote: On Mon, 28 Nov 2005 22:40:28 -0500, I Don't Like Spam <no@spam.com> wrote:
Hexman wrote:
In my program I have several labels that I want to update with information that is being processed in a calculation module. I have code similar to the following in my module. As it goes through its process, I would like to show an update to the counts that are being generated to show progress.
Code in a module........ cntClasses = cntClasses + 1 cntTrials = cntTrials + 3
Form1.lblCntClasses.Text = Format(cntClasses, "###,###") Form1.lblCntTrials.Text = Format(cntTrials, "###,###")
End Code.......
I get errors on the "Form1.lbl......" statements which says "Reference to a non-shared member requires an object reference.".
How do I rectify this? Do I have to refresh Form1 again?
Code examples or suggestions?
Sorry for the newbie questions.
Hexman
you either have to pass a reference to the form and make a property to edit it, or pass the label into the module.
chris
Currently I have 6 labels that I want updated on the form, with more to come. Any preference to either of the methods you mentioned? Any code snippet of either?
Thanks,
Hexman
Why is this code in a module? Why not have the code in the form? Both
of those are preffered ways. To pass the form into a function just do
it like any other call:
Public sub XYZ(F as FormClass)
f.label1text = "String"
end sub
public Class FormClass
public sub CallModule
XYZ(Me)
end sub
end class
Hexman,
Why not use OOP
You have your labels normally on a form and when the user clicks a button
you start to update your labels
In a very very very simplified sample.
\\\\
dim myobject as new myOwnClass(100)
mylabel1 = myobject.mytext1
mylabel2 = myobject.mytext2
///
\\\
Public class MyOwnClass
Public myText1 as String
Public myText2 as Sring
Public sub New (byval PassedToMe as integer)
myText1 = (passedtome*1).ToString
myText2 = (passedtome* 5).ToString
end Sub
///
I hope this gives an idea.
Cor
"Hexman" <He****@binary.com> schreef in bericht
news:1h********************************@4ax.com... In my program I have several labels that I want to update with information that is being processed in a calculation module. I have code similar to the following in my module. As it goes through its process, I would like to show an update to the counts that are being generated to show progress.
Code in a module........ cntClasses = cntClasses + 1 cntTrials = cntTrials + 3
Form1.lblCntClasses.Text = Format(cntClasses, "###,###") Form1.lblCntTrials.Text = Format(cntTrials, "###,###")
End Code.......
I get errors on the "Form1.lbl......" statements which says "Reference to a non-shared member requires an object reference.".
How do I rectify this? Do I have to refresh Form1 again?
Code examples or suggestions?
Sorry for the newbie questions.
Hexman
On Mon, 28 Nov 2005 23:34:35 -0500, I Don't Like Spam <no@spam.com>
wrote: Hexman wrote: On Mon, 28 Nov 2005 22:40:28 -0500, I Don't Like Spam <no@spam.com> wrote:
Hexman wrote:
In my program I have several labels that I want to update with information that is being processed in a calculation module. I have code similar to the following in my module. As it goes through its process, I would like to show an update to the counts that are being generated to show progress.
Code in a module........ cntClasses = cntClasses + 1 cntTrials = cntTrials + 3
Form1.lblCntClasses.Text = Format(cntClasses, "###,###") Form1.lblCntTrials.Text = Format(cntTrials, "###,###")
End Code.......
I get errors on the "Form1.lbl......" statements which says "Reference to a non-shared member requires an object reference.".
How do I rectify this? Do I have to refresh Form1 again?
Code examples or suggestions?
Sorry for the newbie questions.
Hexman
you either have to pass a reference to the form and make a property to edit it, or pass the label into the module.
chris
Currently I have 6 labels that I want updated on the form, with more to come. Any preference to either of the methods you mentioned? Any code snippet of either?
Thanks,
Hexman
Why is this code in a module? Why not have the code in the form? Both of those are preffered ways. To pass the form into a function just do it like any other call:
Public sub XYZ(F as FormClass) f.label1text = "String" end sub
public Class FormClass public sub CallModule XYZ(Me) end sub end class
I have the code in a module because it is a data access module and is
called from several different forms.
Thanks for the example.
Hexman.
On Tue, 29 Nov 2005 08:09:59 +0100, "Cor Ligthert [MVP]"
<no************@planet.nl> wrote: Hexman,
Why not use OOP
You have your labels normally on a form and when the user clicks a button you start to update your labels
In a very very very simplified sample.
\\\\ dim myobject as new myOwnClass(100) mylabel1 = myobject.mytext1 mylabel2 = myobject.mytext2 /// \\\ Public class MyOwnClass Public myText1 as String Public myText2 as Sring Public sub New (byval PassedToMe as integer) myText1 = (passedtome*1).ToString myText2 = (passedtome* 5).ToString end Sub ///
I hope this gives an idea.
Cor
"Hexman" <He****@binary.com> schreef in bericht news:1h********************************@4ax.com.. . In my program I have several labels that I want to update with information that is being processed in a calculation module. I have code similar to the following in my module. As it goes through its process, I would like to show an update to the counts that are being generated to show progress.
Code in a module........ cntClasses = cntClasses + 1 cntTrials = cntTrials + 3
Form1.lblCntClasses.Text = Format(cntClasses, "###,###") Form1.lblCntTrials.Text = Format(cntTrials, "###,###")
End Code.......
I get errors on the "Form1.lbl......" statements which says "Reference to a non-shared member requires an object reference.".
How do I rectify this? Do I have to refresh Form1 again?
Code examples or suggestions?
Sorry for the newbie questions.
Hexman
Thanks for the example. I'll try it.
Thanks,
Hexman
"Hexman" <He****@binary.com> schrieb Why is this code in a module? Why not have the code in the form? Both of those are preffered ways. To pass the form into a function just do it like any other call:
Public sub XYZ(F as FormClass) f.label1text = "String" end sub
public Class FormClass public sub CallModule XYZ(Me) end sub end class
I have the code in a module because it is a data access module and is called from several different forms.
I agree with Chris. You should better either derive the Forms from a base
Form containing the common controls and put the code there, or put the
controls in a Usercontrol and place it on all your Forms.
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Metal2You |
last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that
accesses a Sybase database back end. We're using Sybase SQL Anywhere
9.0.2.3228. I have installed and registered the Sybase...
|
by: sdash |
last post by:
I'm working on a simple formview screen that should update a SQL Server 2000
record. I'm sure there must be something simple wrong, but when I press
update, the screen refreshes and the changes...
|
by: KalariaNitya |
last post by:
Hello,
could anybody help me?
i have gridview, inside gridview i have one Update button & textbox
update button update the quantity entered in textbox.
i want to update the quantity on textbox on...
|
by: sirdavethebrave |
last post by:
Hi guys -
I have written a form, and a stored procedure to update the said form.
It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |