Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CREATING AND MANIPULATING RUNTIME CONTROL

Status
Not open for further replies.

nwt002

MIS
Jun 16, 2005
58
US
Hello All,

I am trying to create an app. that will allow the end-user to create and manipulate controls at run time. I am going to attempt to describe my objective below.

I want to create like an asset management program that attaches to a database. Maybe on the left side of my form I want to have some buttons(let's say..a button with a picture of a computer on it) and on the right side of the form I want to have a picture box that might contain a floorplan image.

I would like to be able to click the button on the left and have it

1. create a new button w/a picture of a computer on it, that can be moved around

2. be able to drag and drop the new button to a position on the floor plan image

3. I want the NEW buttons to open a form, when clicked, that list information that has been saved to a database, about the button(computer/asset) .

So far I have looked up information on creating new controls at runtime using arrays, and draging and dropping controls. The drag and drop code that I have found almost works like I want it to, and i am also able to create new controls with the code that i have, but my main questions are what do i need to do to save the new controls that have been created at run time, so that they appear in the app., at the location they were droped? And how do i go about creating onclick code that only applies to the newly created buttons, not the original button?

If I haven't given enough information or what I am trying to do is not clear, i appoligize and will be happy to provide you with more info. If anyone can answer any of my questions, I would appreciate it. If you have any tips or advice about anything that I am trying to accomplish, that would be helpful and appreciated also. Thanks for your time.

Nick
 

Store the drag&drop position info for each new button, along with any other related info, in a database table. When you open the form, query the DB to get existing button data (total and positions) and use it to position them.

The command button in VB6 doesn't have an onclick event. The Click event for a command button in an array will have it's Index property as a parameter:
Code:
Private Sub Command1_Click(Index As Integer)
'use the Index value to decide what to do
MsgBox Index
End Sub

In your example you would use the value of Index to requery your database for the detail info for that button

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
John,

Thanks for pointing me in the right direction. That all makes sense, so i will give it a shot and see if i can get it to work like i want it. I appreciate your advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top