Solved

how: copy / past,   labels / textboxes, using code in vb???

Posted on 2004-04-02
13
268 Views
Last Modified: 2010-05-02
how: copy / past,   labels / textboxes, using code in vb???

copy me!label1  to  me!label2  or some such method, thanx much.
0
Comment
Question by:vbsterxx
13 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 10745840
If
Text1.text="Text"
Label1.Caption="Text"
Then...


Private Sub Command1_CLick()
Text2.text=Text1.text
End Sub


Private Sub Command2_Click()
Label2.caption=label1.caption
End Sub
0
 
LVL 76

Expert Comment

by:David Lee
ID: 10745848
me!label2 = me!label1
0
 

Author Comment

by:vbsterxx
ID: 10745883
how to copy the control, not just it's caption or value. thanx
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 150 total points
ID: 10745889
Select the control - Edit/Copy then Edit/Paste.
You will then be creating a control array...

Reference each 'copy' of this control array by using the Index property (starting at 0 for the first and so on)...
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 10745891
You can also create more at runtime...see here: http://www.vbexplorer.com/VBExplorer/vb_feature/april2000/april2000.asp
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 15

Expert Comment

by:unknown_routine
ID: 10746274

You can not copy/paste a control at run time.

This is because unilike VB IDE clipboard object won't hold the control information .


0
 
LVL 15

Assisted Solution

by:unknown_routine
unknown_routine earned 150 total points
ID: 10746287
However you can simlute it:

Step 1:

set form keypreview property to true


Step 2:

User select a control, so control is highlighted, and presses Control+C you use form keypress event
to trap this keys.

Step3:

User  presses Control+V(paste) , again you trap these keys and do the paste on position X and Y of form

Which are defined in Form1.CurrentX and form1.currentY
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 11259340
I have supplied a working solution to the question.

Accept with grade A or B seems proper.
Regards.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 11265009
I suggest a split:  sirbounty {http:#10745889} & unknown_routine {http:#10746287}
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 11265762
Split seems good to me.

Regards.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Use closed file on desktop in vba 6 67
Access 2016 VB code 9 104
Macro which automatically sends attachment to Outlook 14 62
VBA error replacing data 6 37
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now