473,666 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add subform to a form?

Can a vb.net form contain a subform? If yes, how is this done?

Maybe I am going about my issue the wrong way. I start an asynchronous
procedure from my main form - invoke a routine on a mainframe computer. Then
I am polling every 10 seconds (timer1) to see if the external program has
generated a data result set for my form to retrieve. In the meantime, on the
same main form I have a series a little labels that blink on/off in a series
for visual status that the program is polling (using a separate timer -
timer2). Well, everytime the program polls - the labels halt their blinking
for a few seconds. I want the labels to keep blinking during the polling. I
tried running timer2 in a separate thread object but that did not work - as I
could not turn timer2 on in the separate thread. So I am thinking to place
the labels in a subform with its own timer that is always running and I can
set a boolean var to turn the labels on and off when the polling stops. So,
is there a way to place a subform on a main form? Or -- how can I set
timer2.Enabled = True in a separate thread on the same form? I thought
timers were on their own threads.

Thanks
Nov 21 '05 #1
2 2057
Why not turn the blink ON (ie: load an embedded resource bitmap or such the
like into a Picturebox control) at the moment you are about to poll. This
blink image will stay on-screen while polling. In fact, it can't disappear,
because it was there prior to the polling, and the polling function has no
way of knowing how to eradicate it from the screen. As soon as the polling
function is complete load a different embedded resource bitmap to indicate
that the polling function is now complete. Voila! Works perfectly. Isn't
this what you're trying to do anyway? (ie: let the user know that polling is
taking place?). If you really want to show the user that the poll is in
progress then your status light should stay ON (ie: visible on the screen)
for the entire time that polling occurs. I do this kind of thing all the
time, but then maybe I'm not understanding exactly what you're doing.

Caution: When you load an embedded resource into a bitmap object via a
stream, and then plunk it into a Picturebox control, the PictureBox control
will reflect the change on-screen almost all the time. But it will not
reflect the change when your application is in the midst of creating a new
form. Therefore, to ensure that the PictureBox control always shows the
correct status light image use "MyPictureBox.R efresh()" immediately after
setting the image.

Also, I've developed clsStatusLight as an object that represents a blinking
status light (RED, GREEN, or YELLOW, with WHITE for "off"). For example, RED
usually denotes a write-access, GREEN usually denotes a read-access, and
yellow usually denotes an error of some kind. This object creates a state
timer on the fly to accomplish nice blinking. Furthermore, you can try to
blink as rapidly as you want but clsStatusLight ensures that a blink-request
during a blink-in-progress is deemed to be the same blink, and therefore
generates no additional load on the system. If you want a copy let me know.

Also, explain in a little more detail if I'm not understanding your
situation.

Thanks,

Tom Edelbrok


"Rich" <Ri**@discussio ns.microsoft.co m> wrote in message
news:6E******** *************** ***********@mic rosoft.com...
Can a vb.net form contain a subform? If yes, how is this done?

Maybe I am going about my issue the wrong way. I start an asynchronous
procedure from my main form - invoke a routine on a mainframe computer.
Then
I am polling every 10 seconds (timer1) to see if the external program has
generated a data result set for my form to retrieve. In the meantime, on
the
same main form I have a series a little labels that blink on/off in a
series
for visual status that the program is polling (using a separate timer -
timer2). Well, everytime the program polls - the labels halt their
blinking
for a few seconds. I want the labels to keep blinking during the polling.
I
tried running timer2 in a separate thread object but that did not work -
as I
could not turn timer2 on in the separate thread. So I am thinking to
place
the labels in a subform with its own timer that is always running and I
can
set a boolean var to turn the labels on and off when the polling stops.
So,
is there a way to place a subform on a main form? Or -- how can I set
timer2.Enabled = True in a separate thread on the same form? I thought
timers were on their own threads.

Thanks

Nov 21 '05 #2
Thanks for your reply. Actually, what I have is 20 little label squares
(rectangles)

*â–ˆ *â–ˆ*â–ˆ* â–ˆ*â–ˆ*â–ˆ *â–ˆ*â–ˆ* â–ˆ*â–ˆ*â–ˆ *â–ˆ*â–ˆ* â–ˆ*â–ˆ*â–ˆ *â–ˆ*â–ˆ* â–ˆ*â–ˆ

They are all light yellow when polling starts then lbl0 turns blue for 100ms
then lbl1 turns blue while the rest go back to light yellow, then lbl2 turns
blue, lbl3 turns blue, etc from timer2. Maybe this is a little bit too cute,
but it keeps the end users from thinking that the program is not working or
is locked up or something. When polling is finished and the file is
retrieved, these labels disappear. My problem is that every 10 seconds (on
timer1) the labels halt the color changing. Each poll takes about 5 seconds.
This gives the illusion that a file is being picked up, when in fact, this
is not the case. The mainframe proc takes about 5-10 minutes to run. Thus,
I am thinking a subform. Any ideas appreciated how to make my visual status
indicator function correctly.

Thanks
**


"Tom Edelbrok" wrote:
Why not turn the blink ON (ie: load an embedded resource bitmap or such the
like into a Picturebox control) at the moment you are about to poll. This
blink image will stay on-screen while polling. In fact, it can't disappear,
because it was there prior to the polling, and the polling function has no
way of knowing how to eradicate it from the screen. As soon as the polling
function is complete load a different embedded resource bitmap to indicate
that the polling function is now complete. Voila! Works perfectly. Isn't
this what you're trying to do anyway? (ie: let the user know that polling is
taking place?). If you really want to show the user that the poll is in
progress then your status light should stay ON (ie: visible on the screen)
for the entire time that polling occurs. I do this kind of thing all the
time, but then maybe I'm not understanding exactly what you're doing.

Caution: When you load an embedded resource into a bitmap object via a
stream, and then plunk it into a Picturebox control, the PictureBox control
will reflect the change on-screen almost all the time. But it will not
reflect the change when your application is in the midst of creating a new
form. Therefore, to ensure that the PictureBox control always shows the
correct status light image use "MyPictureBox.R efresh()" immediately after
setting the image.

Also, I've developed clsStatusLight as an object that represents a blinking
status light (RED, GREEN, or YELLOW, with WHITE for "off"). For example, RED
usually denotes a write-access, GREEN usually denotes a read-access, and
yellow usually denotes an error of some kind. This object creates a state
timer on the fly to accomplish nice blinking. Furthermore, you can try to
blink as rapidly as you want but clsStatusLight ensures that a blink-request
during a blink-in-progress is deemed to be the same blink, and therefore
generates no additional load on the system. If you want a copy let me know.

Also, explain in a little more detail if I'm not understanding your
situation.

Thanks,

Tom Edelbrok


"Rich" <Ri**@discussio ns.microsoft.co m> wrote in message
news:6E******** *************** ***********@mic rosoft.com...
Can a vb.net form contain a subform? If yes, how is this done?

Maybe I am going about my issue the wrong way. I start an asynchronous
procedure from my main form - invoke a routine on a mainframe computer.
Then
I am polling every 10 seconds (timer1) to see if the external program has
generated a data result set for my form to retrieve. In the meantime, on
the
same main form I have a series a little labels that blink on/off in a
series
for visual status that the program is polling (using a separate timer -
timer2). Well, everytime the program polls - the labels halt their
blinking
for a few seconds. I want the labels to keep blinking during the polling.
I
tried running timer2 in a separate thread object but that did not work -
as I
could not turn timer2 on in the separate thread. So I am thinking to
place
the labels in a subform with its own timer that is always running and I
can
set a boolean var to turn the labels on and off when the polling stops.
So,
is there a way to place a subform on a main form? Or -- how can I set
timer2.Enabled = True in a separate thread on the same form? I thought
timers were on their own threads.

Thanks


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
24823
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that contains the subform is named Clients. I have this code in the Add Client btn: If Forms!Clients.subformVisits!VisitDirty = True Then MsgBox "Visit subform is dirty!"
25
10220
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
12
19006
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course, frmBrowseNegsSubform. I would like to perform an ascending or descending sort on any of the 7 columns shown in datasheet view in the subform control. I've been unsuccessful. Is there something tricky about sorting in subform controls?
1
8475
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a subform of the subform. the main Form is called Subform is called Subform in the subform is called
4
7002
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
9
9683
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
6
5967
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()
4
8829
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form which allows me to edit the record in the subform. What I want to happen is for subform with the new edits to be updated on the main form when I close the popup. I'm sure this is a very small bit of code in the the 'On close' event for the popup...
7
12297
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm thinking the Table will stay open otherwise ??? - Do I also need to use code to Assign the Child&Master Links, or can I just type the names into the subForms Control Property and just depend on the SourceObject to link to Table???
11
7150
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my mind I am wonder if this is causing my problem, but I don’t want to go through the work to convert to DAO unless I know it is truly in my best interest.) I am having problems getting a requery to show up consistently on a couple of forms. I have...
0
8352
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
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
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
8636
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
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
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.