Avatar of anthonytr
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Create a subform in VB.net


I'm trying to convert my current Ms Access database into VB.net using Visual Studio 2013.  I'm getting stuck on a number of things, one no more so than trying to setup a 'subform' on a form.

Currently my Access form has its main datasource set from tblBatches and there is a subform at the bottom set to tblReference_data.

For every entry in the tblBatches table there are a number of references in the tblReference_data table.  (1 to many)

How would  replicate this is VB.net (Visual Studio 2013)?  They are linked via Batch Reference from both forms

Visual Basic.NETProgramming

Avatar of undefined
Last Comment

8/22/2022 - Mon
Jacques Bourgeois (James Burger)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question


I agree. There is really no such concept as a subform like in Access. A form in vb.net is merely a visual U/I window of the application. In terms of your 1 to many relationship issues that an Access subform solves, as mentioned above you can have your normal fields on top and a DataGridView for related data.  You could also represent this with a ListViewControl, or even a TreeView control or TreeView and Listview controls in combo depending upon your data and how you want the app to work. Basically you write the logic so that when the user clicks on whatever represents the next record, maybe a node in a tree or main ListView, the other part is populated (by your code). Of course there are ways to bind data to avoid some of that work, but it isn't really that difficult.

Google: "vb.net datagridview Examples" for tons of samples.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck