Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Inserting or drawing objects during runtime
 

Inserting or drawing objects during runtime

How can I insert or draw an object during the runtime ?
mmmt  Wednesday, December 31, 2008 11:46 PM
If you want to add a control to some container at runime, you just add it to the container's Controls collection.
For example, if you want to add a button to a form:
1PrivateSubForm1_Load(ByValsenderasObject,ByValeasEventArgs)HandlesMyBase.Load
2DimbasButton=newButton()
3b.Text="Test"
4b.Anchor=AnchorStyles.LeftOrAnchorStyles.Top
5Me.Controls.Add(b)
6EndSub
7

Regards

-- Don't forget to close the thread by marking the correct post(s) as ANSWERED!
  • Marked As Answer bymmmt Thursday, January 01, 2009 12:36 AM
  • Marked As Answer bymmmt Thursday, February 05, 2009 9:13 PM
  • Unmarked As Answer bymmmt Thursday, February 05, 2009 2:51 PM
  •  
Marcel Nita  Thursday, January 01, 2009 12:31 AM
What do you mean by object? Control or a graphical figure?
For custom drawing there are numerous threads, here on MSDN Forums. Try searching.

-- Don't forget to close the thread by marking the correct post(s) as ANSWERED!
Marcel Nita  Thursday, January 01, 2009 12:02 AM
Marcel Nita said:

What do you mean by object? Control or a graphical figure?
For custom drawing there are numerous threads, here on MSDN Forums. Try searching.


-- Don't forget to close the thread by marking the correct post(s) as ANSWERED!



I mean by the object, a control.
mmmt  Thursday, January 01, 2009 12:31 AM
If you want to add a control to some container at runime, you just add it to the container's Controls collection.
For example, if you want to add a button to a form:
1PrivateSubForm1_Load(ByValsenderasObject,ByValeasEventArgs)HandlesMyBase.Load
2DimbasButton=newButton()
3b.Text="Test"
4b.Anchor=AnchorStyles.LeftOrAnchorStyles.Top
5Me.Controls.Add(b)
6EndSub
7

Regards

-- Don't forget to close the thread by marking the correct post(s) as ANSWERED!
  • Marked As Answer bymmmt Thursday, January 01, 2009 12:36 AM
  • Marked As Answer bymmmt Thursday, February 05, 2009 9:13 PM
  • Unmarked As Answer bymmmt Thursday, February 05, 2009 2:51 PM
  •  
Marcel Nita  Thursday, January 01, 2009 12:31 AM

You can use google to search for other answers

Custom Search

More Threads

• active directory search to see if any users has a certain entry and list their name and attribute value
• How do I use a collection to populate an xml file?
• Between Operator For Date
• HTML editor control
• Taking user input from MS-Word to plain text
• how to get binding navigator work
• Runtime error.
• Making a browser toolbar. ActiveX Anyone?
• Please help with my Date Calculator. VB 2005.
• Adding characters between characters in a line of text