|
-
Sep 5th, 2001, 04:49 AM
#1
Thread Starter
Addicted Member
-
Sep 5th, 2001, 04:53 AM
#2
Retired VBF Adm1nistrator
VB Code:
Option Explicit
Private Sub Form_Load()
SetText Text1, "This is a test"
End Sub
Private Sub SetText(txtBox As TextBox, txt As String)
txtBox.Text = txt
End Sub
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Sep 5th, 2001, 04:57 AM
#3
Lively Member
asd
'in module
public sub ChangeCommandNamne(aButton as vbButton, strName as String)
aButton.caption = strName
end sub
'in form
call ChangeCommandNamne(me.command1, "a new name")
hope it works
-
Sep 5th, 2001, 05:01 AM
#4
Thread Starter
Addicted Member
-
Sep 5th, 2001, 05:04 AM
#5
Thread Starter
Addicted Member
Originally posted by mrdarkwarez
asd
'in module
public sub ChangeCommandNamne(aButton as vbButton, strName as String)
When I run this I get "User defined type not defined", Where would I have to define this?
Thanks,
Gavin
-
Sep 5th, 2001, 05:14 AM
#6
PowerPoster
hi
VB Code:
'Form level
Private Sub Command1_Click()
ChangeCaption Command1
End Sub
'Module
Sub ChangeCaption(lCommand As CommandButton)
lCommand.Caption = "Changed"
End Sub
'I dont think u need a function cos there is no return value
Regards
Stuart
-
Sep 5th, 2001, 05:51 AM
#7
Retired VBF Adm1nistrator
Originally posted by Gavin_Mannion
You have lost me a bit here,
Isn't this code for a Textbox? I am looking for how to change the caption on a button, or better yet change any details of a button.
Yes the code I posted is for a textbox, but is easily changed to a commandbutton :
VB Code:
Option Explicit
Private Sub Form_Load()
SetText Command1, "This is a test"
End Sub
Private Sub SetText(cmdBtn As CommandButton, txt As String)
cmdBtn.Caption = txt
End Sub
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|