-
Hey,
I'm making a program and i have to where if some one RIGHT clicks a button then they can edit the buttons Name,Text,Tag,and Tooltiptext....
I have it to where there are MANY buttons.
When u right click Any button it will open Form2 with THAT buttons TEXT,TAG, Ect..
i got all that but the problem is..
In the Second form (Form2) i made a button, so when they click it, then the New information they typed will be the Form1 Button's Tag,Text,Ect. But i can't find a way to tell it what Button to save it to
EX.
form 1 BUTTON:
Form2.Textbox.Text = Form1.Button.Tag
but for Form2 i have
Form1.(How do i put name here).Tag = Form2.Textbox.text
how would i go about doing this??
-
Try below code, and hope this is what u want.
On Form1, u have more than two, but let's say there's 2 buttons
Code:
Option Explicit
Private pvarButton As CommandButton
Property Get GetButton() As CommandButton
Set GetButton = pvarButton
End Property
Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Set pvarButton = Command2
Form2.Show vbModal
End If
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Set pvarButton = Command1
Form2.Show vbModal
End If
End Sub
On Form2, u need 3 textboxes for Caption, Tag, and toolTipText, and one Apply button. However, u can't edit name of button.
Code:
Option Explicit
Private pvarButton As CommandButton
Private Sub Command1_Click()
pvarButton.Caption = txtName
pvarButton.Tag = txtTag
pvarButton.ToolTipText = txtToolTip
Set pvarButton = Nothing
Unload Me
End Sub
Private Sub Form_Load()
Set pvarButton = Form1.GetButton
End Sub
Joon
-
hEY tHE script above looks like it would work. The left clicking works but when you Right click like the script said to. it gives an error about a "Type Mismatch" on: Set pvarButton = Command1 Where command1 is.. is that where u put the buttons name? cause thats what i did and it kept crashing.
Thanks
OPPS.. My fault i did something wrong with the writing..
it works now. Thanks
[This message has been edited by progeix (edited 11-25-1999).]
[This message has been edited by progeix (edited 11-25-1999).]