473,652 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to update label.txt from a module????

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.lblCntCla sses.Text = Format(cntClass es, "###,###")
Form1.lblCntTri als.Text = Format(cntTrial s, "###,###")

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
Nov 29 '05 #1
7 2937
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.lblCntCla sses.Text = Format(cntClass es, "###,###")
Form1.lblCntTri als.Text = Format(cntTrial s, "###,###")

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
Nov 29 '05 #2
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.lblCntCla sses.Text = Format(cntClass es, "###,###")
Form1.lblCntTri als.Text = Format(cntTrial s, "###,###")

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
Nov 29 '05 #3
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
informatio n 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.lblCntCla sses.Text = Format(cntClass es, "###,###")
Form1.lblCntTri als.Text = Format(cntTrial s, "###,###")

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
Nov 29 '05 #4
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.mytext 1
mylabel2 = myobject.mytext 2
///
\\\
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.c om...
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.lblCntCla sses.Text = Format(cntClass es, "###,###")
Form1.lblCntTri als.Text = Format(cntTrial s, "###,###")

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

Nov 29 '05 #5
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
informati on 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.lblCntCla sses.Text = Format(cntClass es, "###,###")
Form1.lblCntTri als.Text = Format(cntTrial s, "###,###")

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.
Nov 29 '05 #6
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.mytext 1
mylabel2 = myobject.mytext 2
///
\\\
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.lblCntCla sses.Text = Format(cntClass es, "###,###")
Form1.lblCntTri als.Text = Format(cntTrial s, "###,###")

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

Nov 29 '05 #7
"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

Nov 29 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2199
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 .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly at run time. The application I'm writing is a bit more complex than the example I'm about to...
0
2485
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 are not committed to the table. Can anyone give me some suggestions here? Thanks in advance (code below) <%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditItem.aspx.cs" Inherits="EditItem" %>
0
2526
KalariaNitya
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 ENTER event. i had done below code: page_load()
2
2629
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 update the information which is stored in a SQL database. In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8811
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8703
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8589
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.