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.
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.'
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
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.....
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("VB.line", "lineObj_" & Trim(Str(i)))
With lineObj(i)
.Visible = True
.X1 = 100 + (i * 100)
.Y1 = 100
.X2 = 1000 + (i * 100)
.Y2 = 1000
End With
Else
MsgBox "No mas ya hay 30 rayas"
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.