469,360 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

How do I create a subform inside a form in VB.net

maxamis4
295 Expert 100+
I just want to create a sub form in VB.net, how do i do this.

say my variables are form1

UID
value 1
Value 2
Value 3


Form 2
UID
Foreign Key(UID form1)
value 2
value 3
Jan 12 '07 #1
4 9745
bplacker
121 100+
I just want to create a sub form in VB.net, how do i do this.

say my variables are form1

UID
value 1
Value 2
Value 3


Form 2
UID
Foreign Key(UID form1)
value 2
value 3


in form1,

form2.UID = UID
form2.value2 = value2
form2.value3 = value3
form2.show()

does this answer your question?
Jan 12 '07 #2
maxamis4
295 Expert 100+
Do i do this on load? and secondly will my subform be visible inside the parent form?

So in essence in the same form I will see form 1 and the sub form at the sametime in one form. If your familiar with access its exactly like that.
Jan 12 '07 #3
bplacker
121 100+
Do i do this on load? and secondly will my subform be visible inside the parent form?

So in essence in the same form I will see form 1 and the sub form at the sametime in one form. If your familiar with access its exactly like that.

i would put a button on form1 which opens up form 2

so on the click event of the button, do the code similar to what I typed in the previous post.

if you want to make the form a "subform" of the first form, as in access, this isn't really possible. you just add a datagrid, or whatever control you want in the form. There is no reason to have a subform as they do in access. if you really want to have a second form, then look up MDI forms.
Jan 12 '07 #4
maxamis4
295 Expert 100+
I found this pieace of code which doesn't exactly accomplish what I want but could be useful. I thought that I would share it, try it out

Expand|Select|Wrap|Line Numbers
  1. Dim f As New frmEmbed2() 
  2. f.TopLevel = False 
  3. Me.Controls.Add(f) 
  4. f.Show() 
  5.  
or just go to the following link

Reference to code
Jan 12 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Paul T. Rong | last post: by
1 post views Thread by Terrell Miller | last post: by
1 post views Thread by Stephen D Cook | last post: by
6 posts views Thread by DMUM via AccessMonster.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.