?
Solved

Using Twips

Posted on 2000-04-29
9
Medium Priority
?
205 Views
Last Modified: 2010-05-02
Dear experts i need your help to answer the following question:

Suppose you had a command button called Duplicate.  Write code so that when Duplícate is pressed, a new copy of the button appears 200 twips below the bottom of the original.

Thanks,

Jairo Cardenas
Colombia
0
Comment
Question by:jcardenas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2762346
Suppose your command button on the form is at 720, 960. It will move to 720, 1160 when it clicks.

Option Explicit

Private Sub Command1_Click()
Command1.Move 720, Top + 200
End Sub
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2762349
Oops. That's not what you wanted. Sorry for misunderstanding.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2762358
Place a command button on the form.

Private Sub Command1_Click()
Dim otxtnew As CommandButton

Set otxtnew = Controls.Add("VB.commandbutton", "otxtNew")
With otxtnew
..Visible = True
..Caption = "Duplicate1"
..Width = Command1.Width
..Height = Command1.Height
..Top = Command1.Top + 200
..Left = Command1.Left
End With
End Sub
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Accepted Solution

by:
Marine earned 30 total points
ID: 2762403
You can also use Load Statement to create a control array. In design time you can place a 0 into Index of a command button then when you click on the command button in click event you can have this.

It would look something like this.
After you set the Index of first command button to 0
Private Sub Command1_Click(Index As Integer)
Load Command1(1)
Command1(1).Move Command1(0).Left + Command1(0).Width, 900
Command1(1).Visible = True
End Sub
0
 
LVL 6

Expert Comment

by:Marine
ID: 2762406
well just replace the 900 by the whatever value of the top of the first command button like this. command(0).top
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2762440
Correction: It moves below the bottom of the original command button, not next to the original.

Private Sub Command1_Click(Index As Integer)
Load Command1(1)
Command1(1).Move Command1(0).Left, Command1(0).Top + 200
Command1(1).Visible = True
End Sub
0
 
LVL 6

Expert Comment

by:Marine
ID: 2762445
Sorry , i placed 900 there because that was the current position of the top then when i realized his is not goign to be there i told to place the top of the button but didn't add anything to it :(.
0
 

Author Comment

by:jcardenas
ID: 2762653
Hey friends thanks,

jairo
0
 
LVL 6

Expert Comment

by:Marine
ID: 2762668
Um, you should have awarded this points to Ruchi he has helped more. Although, Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

801 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