How to Create a Parent-Child Relationship Using VB.NET

104 198
    • 1). Open the Visual Studio software in the Windows ".NET Framework" program group. Open your VB.NET Windows project.

    • 2). Double-click the form you want to use to create the parent-child relationship. Drag and drop a container to the form. For instance, the "Panel" control is a simple container that lets you contain any VB.NET controls. When you add a panel to the form, the form is the panel's parent and the controls within the panel are the child controls.

    • 3). Drag and drop a control from the toolbox to the panel container. For instance, drag and drop a text box control to the container. The text box parent is the panel, but the text box does not contain any controls, so it has no children.

    • 4). Double-click the VB.NET code file to work with the parent-child relationships. For instance, type the following code to display the parent for the text box:

      MsgBox textbox1.Parent.ToString()

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.