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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Line Object

Status
Not open for further replies.

xspanner

Programmer
Jan 16, 2002
29
0
0
RO
hi everyone.

I want to create 50-60 line OBJECTS during run-time.
Is there any way?

Those lines have to be objects like lines drawn in design-time because i need their coordinates, drawing properties etc.. and i have to delete some of them later..
 
There are many threads that have covered this. Some very recently. You can do a search for these. Look for subjects like "Control Arrays" and the "load" keyword.

Robert
 
Is this an accidental double post of your thread222-612742 dated yesterday? If not, see faq222-2244 to see why repeated posts aren't a good idea

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Don't know it is what you looking for

Option Explicit
Private WithEvents lineObj As Line

Private Sub Form_Load()
Set lineObj = Controls.Add("VB.line", "lineObj")
With lineObj
.Visible = True
.X1 = 100
.Y1 = 100
.X2 = 1000
.Y2 = 1000
End With
End Sub


The chilean Dream Team
 
thanx poltergeits this is what i have been looking for.
I have to create more lines.
Could you send me a version with an array example?
set lineObj(i)=Controls.add does not work.....

thanx
 
This solution is not very elegant, because it wasn't possible for me create a Array_Name, but this also will be doing.
My question > do you will capture some event of the line object because it doesn't have a mouse-event.


If i < 30 Then
i = i + 1
ReDim lineObj(i)
Set lineObj(i) = Controls.Add(&quot;VB.line&quot;, &quot;lineObj_&quot; & Trim(Str(i)))
With lineObj(i)
.Visible = True
.X1 = 100 + (i * 100)
.Y1 = 100
.X2 = 1000 + (i * 100)
.Y2 = 1000
End With
Else
MsgBox &quot;No mas ya hay 30 rayas&quot;
End If

 
No they don't, but i have to move and delete them during run-time
 
Should be:

ReDim Preserve lineObj(i)

Unless you want to erase all of the previous objects stored in the array.

Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top