473,397 Members | 1,961 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,397 software developers and data experts.

labels

i have 2 forms.. one is windows form and I have a lable there that i do want
to control from class1. I thought I could send a referense to the label but
I don't know how to do that in VB
How do I declare the referens in class2??? I need to change color+text from
class2
Public Class Clas1
Inherits System.Windows.Forms.UserControl
Friend WithEvents lblStatus As System.Windows.Forms.Label
private cl As new Class2

Cl = new Class2(lblStatus)
End class

Public Class Class2

Public Sub New(ByRef instLblText As System.Windows.Forms.Label)
Init()
End Sub

Private Sub Init()
'I need here to give instLblText a green background ans chande it's
color and update the grafic in clas one where the label is shown
End Sub
End class
--
LZ
Jan 10 '06 #1
1 1277
"Lamis" <La***@discussions.microsoft.com> schrieb
i have 2 forms.. one is windows form and I have a lable there that i
do want to control from class1. I thought I could send a referense
to the label but I don't know how to do that in VB
How do I declare the referens in class2??? I need to change
color+text from class2
Public Class Clas1
Inherits System.Windows.Forms.UserControl
Friend WithEvents lblStatus As System.Windows.Forms.Label
private cl As new Class2

Cl = new Class2(lblStatus)
End class

Public Class Class2

Public Sub New(ByRef instLblText As System.Windows.Forms.Label)
You don't have to pass it ByRef here. See also:
http://groups.google.com/group/micro...e83beb9988aabf

Init()
End Sub

Private Sub Init()
'I need here to give instLblText a green background ans chande
it's color and update the grafic in clas one where the label is
shown
End Sub
End class

3 ways:

a) Change the color in Sub New - you already have the reference there:

instLblText.backcolor = color.green

b) Pass the reference to Sub Init:

Public Sub New(ByVal instLblText As System.Windows.Forms.Label)
Init(instLblText)
End Sub

Sub Init (Byval lbl As System.Windows.Forms.Label)

lbl.backcolor = color.green

end sub

c) Store the reference in a field - if you also need it later, not only in
sub New:

private f_Label as label

Public Sub New(ByVal instLblText As System.Windows.Forms.Label)
f_label = instLblText
Init()
End Sub

Sub Init ()

f_label.backcolor = color.green

end sub
Apart from this, I wonder why you want to pass the label at all. Isn't it
possible to do the same in Class1. I mean, that's (usually) what the
Usercontrol is used for.
Armin

Jan 10 '06 #2

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

Similar topics

0
by: madeo | last post by:
hi, i'm looking for some script which would export address labels from a mysql db to pdf ... There's an exapmle, but i'm not able to convert it for using with mysql ... can anybody help? THX...
2
by: Martin O'Rourke | last post by:
All, I am hoping someone might be able to put me out of my misery and let me know if it is possible or not to dervie the name of an element in a form, based on its associated label, only knowing...
2
by: DBQueen | last post by:
I have a database which will be printing out labels for SMALL test tubes (1/4" high). We have yet to find a reasonably-priced printer (labelwriter) which can effectively print this on ROLLS of...
6
by: DebbieG | last post by:
I am creating a database for a small department in a university. Each student in their database can have 2 mailing addresses. They wanted mailing labels pulling just the 1st address. No problem....
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
2
by: John Smith | last post by:
Perhaps the wrong place to ask but...Friend has names and addresses in Microsoft Works Database...how can she print off address labels from this database? Thanks, John
10
by: John Baker | last post by:
Hi: I have a user who has labels that are set up 3 across and 11 vertical (which is unusual at best), and he wants me to print names and addresses on them. I have already set up for labels 10...
6
by: Ron | last post by:
Hi, I know Access allows for easy construction of a report setup to print labels from a table/query, etc. I've done that one. It works pretty well for what I need. However, is there an...
0
by: xikom01 | last post by:
In this age, there is a lot of focus on the importance of "getting organized." There are even professional organizers for hire! Labels are a huge presence in the field of organization, because they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
0
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.