473,804 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.UserContr ol
Friend WithEvents lblStatus As System.Windows. Forms.Label
private cl As new Class2

Cl = new Class2(lblStatu s)
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 1292
"Lamis" <La***@discussi ons.microsoft.c om> 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.UserContr ol
Friend WithEvents lblStatus As System.Windows. Forms.Label
private cl As new Class2

Cl = new Class2(lblStatu s)
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.bac kcolor = color.green

b) Pass the reference to Sub Init:

Public Sub New(ByVal instLblText As System.Windows. Forms.Label)
Init(instLblTex t)
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.backcol or = 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
19903
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 a lot Martin :)
2
3481
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 the value of the label, and working on the assumption that the <label for="???" links to the <select id="???" Below is the html that I am working from, which has been dynamically created. Unfortunately I have no control over this at all. I...
2
3011
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 labels....due to slippage, soon you have the printout missing the label. So we are thinking that we have to use sheets of labels. HOWEVER, one job may need 15 labels, another may need 8, etc. Does anyone have a solution for how to set this up in...
6
2113
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. However, now they want a second label for students that have a second mailing address. Any ideas of how I can accomplish this? Thanks in advance for any help.
3
4331
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 using a report I created and then printing them on a continuous-feed dot matrix printer. I used the Label Wizard, chose the query I created, picked the 'Avery USA 4146' (1 7/16" x 4") - 3 across, paper size: 'Fanfold 358mm x 12 in', and Printer:...
3
2339
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. Also, I am using a "Report Header" to show a count of how many total labels that are being printed. Now, my problem is that without the "Report Header", the spacing is perfect. But, when I add the Report Header, it gets shifted downwards and the...
2
2233
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
2944
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 vertical and 3 across (Avery 5160)which are another standard the user has, but can't find any in the setup for labels that show 11 vertical. I am therefore using the Avery 5160 as a start, and modifying the top and bottom margins (the margins on the...
6
8675
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 example anywhere that someone can point me to that is more flexible? And, I mean flexible in this regard:
0
1582
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 enable everything to be tagged and put in its place. From birthday party invitations to mass market mailings to identifying file folders, consumers frequently employ labels in their everyday lives. Labels are a convenient and simple way to...
1
10351
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10096
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
9174
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...
1
7638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5534
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
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.