473,889 Members | 2,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

maxamis4
295 Recognized Expert Contributor
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 10373
bplacker
121 New Member
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 Recognized Expert Contributor
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 New Member
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 Recognized Expert Contributor
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

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

Similar topics

1
3065
by: Max Harvey | last post by:
Hi, I made up a nice little form which had its own sub form in it. I made a litle VB code so that when I pressed a button it would move form the form (frmConference) to the subform (frmBookingBookingBased), start a new record, and copy some values form the form into some fields in the subform, and then leave the cursor sitting (in focus) at the begining of the subform.
2
376
by: Salad | last post by:
I have a sub routine that I'd like to use to get data from a main form or from a subform preferably using 1 variable. Ex: If Me.OpenArgs = "SF" Then strForm = "MF!SF" Else strForm = "MF" Endif Me.Text1 = Forms(strForm)!Text1
3
3384
by: Paul T. Rong | last post by:
there is a form "order" which includes a subform "order_detail", and a checkbox called "save" in the form "order". what I want to do is when I click "save", the "order_detail" subform will be locked, I mean the data inside "order_detail" thus can not be edited. here goes the code: ------------------------------------------
3
4159
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form showing customer data, there is a tab control. One of the tabs has a subform showing order data (in datasheet view). On the same tab there is an unbound textbox (next to the datasheet). I placed a
1
1826
by: Terrell Miller | last post by:
Help, I'm getting strange results on a subform and I'm wondering if anybody knows what is causing it... I have a form linked to TableA. On that form is a tab control. Page1 is just the controls for TableA, except for the caseID (PK) which is above the tab control. Then on Page2 of the tab I have a linked subform that's bound (via caseID so it's a one-to-one relationship due to number of fields) to TableB, and so on for Page3.
0
1948
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set to and the source object is the subform. My subform record source is a query from another table (vacationTbl). FYI: I was filtering on the subform, but removed it and replaced with
1
3224
by: Stephen D Cook | last post by:
I have a form with txtSN text box, btnShow button, and a subform. The form is bound to a Table. The button is bound to a lookup query. The query is bound to the text box. I want to be able to show the query inside a box on the form using the button. When I run the form, the subform gets populated with the first record of the Table. I do not want this to occur. I want it to be blank or not visible til I click the Show button.
4
5048
by: Ryan | last post by:
I've got a little bit of code that runs when you enter data in a datasheet view (which is a subform of the form you are in) if rst!DateReceived >= 30 Then Forms!DisposalRecords.Label90.Caption = (Date - rst!DateReceived) & " Days" however, when that runs to update the caption, it says that it cannot find form DisposalRecords
6
5999
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few forms in the database that will use this function, so I need to be able to tell the code which form to unlock. What I have is as follows: Public Function akeyEdit()
5
9570
by: ritpras | last post by:
I was wondering if it was possible to have a form inside a tab control? So when a tab is clicked, there is a form within it. If it is possible, then how should I go about doing it? Thank you.
0
9961
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9803
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10439
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5825
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4642
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4248
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3252
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.