borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (String)Next Topic (Process Owner (UserName)) New Topic New Poll Post Reply
AndreaVB Forum : VB General : change the caption of a control of any place on project
Poster Message
bybruno
Level: Protégé

Registered: 16-09-2005
Posts: 6

icon change the caption of a control of any place on project

change the caption of a control of any place on project

hi i want to change the caption of a control of any place on project.

i have a object: label1 in form1 and form2
now i want call a public function with this sintax teste form.name,control.name )

now i want that in public function change the caption of the object like this

public teste ( form.name,control.name )

form.name.control.name.caption ="result"



end sub

any one can help me?
thanks a lot
bruno

13-08-2006 at 07:05 PM
View Profile Send Email to User Show All Posts | Quote Reply
lbuntha
Level: Scholar

Registered: 05-05-2006
Posts: 39
icon Re: change the caption of a control of any place on project

I am not sure  your question but i suppose you may be want to change caption of each control with public function.
If you want to do this, you should declare variable in module or class.
In module
   public const caption="My Caption"
   when you set caption for each control, you should use the below code:
   formName.lable1.Caption=caption
   you do like this while modifying caption in module then all captions will be changed automatically.

____________________________
ly buntha

14-08-2006 at 07:13 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907
icon Re: change the caption of a control of any place on project

Hello. Does something like following...
Public Sub ChangeCaption(ctl As Control, newcaption As String)
    On Error Resume Next
    ctl.Caption = newcaption
End Sub


' usage sample
Private Sub btnChangeLabelCaption_Click()
    ChangeCaption Me.Label1, "this is a new caption"
End Sub
make any sense to you?

Hope it helps

____________________________
Real Programmer can count up to 1024 on his fingers

14-08-2006 at 11:53 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : change the caption of a control of any place on project
Previous Topic (String)Next Topic (Process Owner (UserName)) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder