Child Form Opens Up At Random In MDIparent Form
My VB6 application follows the MDI format. I have several child forms under the parent MDIform. Whenever i click search button in the my main child form, other child form also opens up. I dont know how to stop unwanted child form to open up at random. Could someone please help. thanks.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Child Form Opens Up At Random In MDIparent Form
My VB6 application follows the MDI format. I have several child forms under the parent MDIform. Whenever i click search button in the my main child form, other child form also opens up. I dont know how to stop unwanted child form to open up at random. Could someone please help. thanks.
Why Child Form Opens ??
When I run the code below the child form (frmSI) appears??? why???
Code:
Private Sub msknfe_LostFocus()
If Me.mskNFE.Text <= Me.mskNFS.Text Then
MsgBox "bla bla bla'"
Me.mskNFS.SetFocus: SendKeys "{Home}+{End}"
Else
Me.txtNFWt = DateDiff("n", Me.mskNFS.Text, Me.mskNFE.Text)
End If
If Me.cboNFQ = "1.BackFile" Then
Me.txtNatFilA = CInt(Me.txtNatFilD) - (Me.txtNFWt / 60 * CInt(frmSI.txtSInfBF))
End If
Scanning All Form's Object From The MdiParent Form
Dear,
I have a project with about 300 forms.
In a table of my database i have their names.
So i would like to record all the objects of every form in my db by writing something on the mdi parent form.
I try with CreateObject and GetObject methods by passing the string of the form's name, but i have the error message Activex component can't create object.
Any ideas?
Many thanks
I call the following Sub on The Load event of MdiForm
Private Sub FillObjects(frmName As string)
Dim obj as Object
Dim ctl as Control
set obj=CreateObject(frmName)
' GetObject has also the same problem
for each ctl in obj
' Execute Commands on the database
next
End Sub
Forms: Need Select/Where OR Filter So Form 2 Opens With Form 1 Current Record
Should be easy... and will be when I get an answer...
Visual Basic forms app. I have two forms (frm_Offenders and frm_Vehicles). frm_Offenders works great (add, edit, delete records). frm_Offenders uses tbl_Offenders Access DB. frm_Offenders has a button to open frm_Vehicles. frm_Vehicles works great (add, edit, delete). frm_Vehicles uses tbl_Vehicles Access DB.
Problem is this... when I press button from frm_Offenders I need frm_Vehicles to open only showing records where CARDS_ID is equal. CARDS_ID is an autofill numeric field in tbl_Offenders (prime key). tbl_Vehicles also has a CARDS_ID field that is not autofill but is a prime key. When frm_Vehicles is open and you press the "Add" button a new record is created in tbl_Vehicles and the CARDS_ID field is autopop with the current record CARDS_ID from frm_Offenders.
So... both tables have CARDS_ID field. I need frm_Vehicles to open to the current record selected in frm_Offenders. Also no DataGrid view. Both forms have listboxes that when record is selected all other fields (name, address, etc.) are bound.
Currently frm_Vehicles opens with all records. tbl_Vehicles data would look something like this:
CARDS_ID v_Year v_Make v_Model
34 2000 Ford F-150
34 2007 Niss Pathfinder
35 2005 Dodg RAM 1500
36 1990 Chev Camero
tbl_Offenders data would look something like this:
CARDS_ID Name_Last Name_First Name_Mid
34 Smith John James
35 Doe Billy Bob
36 Sharp Albert Oscar
In short everything works great except being able to filter records on frm_Vehicles. Think I need a "Where frm_Offenders.CARDS_ID = frm_Vehicles.CARDS_ID" type of statement.
Please help!
Edited by - wbwalsh on 9/2/2007 1:58:07 PM
Center A Mdichild Form In A Mdiparent
I am using an mdiparent form. What I want to do is place the mdichild form in the center of the mdiparent form when the mdichild loads. Do you have any suggessions?
Resizing A Picture Box On MDIParent Form *Resolved*
Hi All,
I couldn't find anything on how to create a resizable picture box on a MDI Parent form. So last night I mutilated various bits of code from the API-Guide (www.allAPI.net) and came up with the attatched.
However, it's not perfect because I couldn't figure out how to successfully determine the position of the mouse relative to the form. So when you resize to the extreme left or right the resize bar is slightly out of sync with the cursor.
It's probably a simple mistake, but I cannot for the life of me get my head around it. Any ideas? (I even thought of just hiding the mouse cursor all together when resizing, but stopped myself because that's plain lazy and it would bug me for ages).
Thanks in advance.
Jordan
Access Public Controls On Mdiparent Form
I have a child form when the user can add some information. If they add a new entry I want to add that entry to a dropdown on the mdiparent form and make that the selected entry. I can't compile because it can't reference the control at design time. Is there a way I can do this without doing something kludgey like using a modal window and storing some global values which I process on the exit from the child form?
Get MDIParent Of MDI-Child
How could I get a reference to the parent MDI-Form without having a membervariable in the child form?
If it works with the parent property of the childform, please give me an example, because it didn't work.
thank you for each answer!!
Ungi
Mdiparent - Child Problem In .NET
OK I think I understand how to get a mdichild form to work in my application, I'm using the following
'from the (parent1) form1 which is the mdiparent form
dim child1 as new form2()
child1.mdiparent = me
child1.show()
Now the problem is, I want to open child2 (form3) from child1 and haven't got a single clue how to do it. I have tried this code in child1 and the problem is after the code
dim child2 as new form3()
child2.mdiparent = parent1
child2.show
and it says "parent1 is a type and cannot be used as an expression"
Thanks for the help
Make A Main Form Using MDI Form And Child Form
Hi there,
How can I create a child form that attached to the MDI form so that the MDI form and the child form looks like a single main MDI form in runtime ? I've tried to made it by disabling the min & max button of the child form and then load the child form in the MDI Form Load method, but with that way the child form can't be seen at the runtime.
Pls help me
MDI Form With Child Forms - External Form/window To Interact With Child Forms?
Hi,
I am creating an application which has an MDI Form containing 2 child forms.
I need to somehow create either a floating toolbar or some sort of external form (ie. not a child form) which is able to interact with the child forms.
Is this possible? If so, any feedback on how to create it would be much appreciated
Thanks,
Chris
Returning A Value Found In A Child Form To A Specific Text Box In The Parent Form?
I have two forms. A parent and a child. The parent has many labels which are selectable. Once one of the many lables is selected, a child form pops up to gather info. Once the info is gathered, i want to be able to put that info into the label in the parent form which called the child! How can this be done? The problem i cant get past is when the child returns, i have no way to know which label called the child in the first place to put the info in.
Thanks in advance
Call The Save Method Of An MDI Child Form From The MDI Form Toolbar Menu Caused Error
Hi all,
This step-by-step article 818367 describes how to call the Save method in a multiple document interface (MDI) child form when you click the Toolbar button on the MDI Form.
However, execute statement <Me.ActiveForm.cmdSave_Click> ended up with error saying "Object does'nt support this property or method". Please advise and appreciated.
1. Start Visual Basic 6.0.
2. On the File menu, click New Project. In the New Project dialog box, click
Standard EXE, and then click OK.
3. In Solution Explorer, right-click Form1, and then click Remove Form1.
4. On the Project menu, click Add MDI Form.
5. In the Add MDI Form dialog box, click MDI Form, and then click Open.
6. Set the Name property of the MDI Form to frmMDI, and then set the
WindowState property to Maximized.
7. On the Project menu, click Add Form. In the Add Form dialog box, click
Form, and then click Open. By default, the Form1 form is created
8. Set the MDIChild property of the Form1 form to True, and then set the
Borderstyle property of the Form1 form to Fixed Dialog.
9. Add a command button and a text box to the Form. Set the Name property
of Command Button to cmdSave, and then set the Caption property to
Save.
10.To view the code editor, double-click the Save command button. Change
the Click event scope of the cmdSave event handler from Private to Public.
11. Repeat step 5 through step 8 two times. This adds MDI child form Form2
and MDI child form Form3.
12. Add the following code to the Click event of the Save command button of
the MDI child form Form1:MsgBox " Save event of MDI Child Form: Child1"
13. Add the following code to the Click event of the Save command button of
the MDI child form Form2:MsgBox " Save event of MDI Child Form: Child2"
14. Add the following code to the Click event of the Save command button of
the MDI child form Form3:MsgBox " Save event of MDI Child Form: Child3"
15. On the Project menu, click Components. Click Microsoft Windows Common
Controls 6.0, and then click OK.
16. Double-click the Toolbar control in the toolbox. Right-click Toolbar, and
then click Properties.
17. Click the Buttons tab in the Toolbar Properties dialog box, and then click
Insert Button to add a Toolbar button. Set the Caption property of the
Toolbar button to Save, and then set the Key property to Save.
18. Click OK.
19. To view the code editor, double-click the Toolbar to open in Code view.
20. Add the following code to the Click event of the Toolbar:
On Error GoTo NoActiveForm
Select Case Button.Key
Case "save"
Me.ActiveForm.cmdSave_Click
End Select
Exit Sub
NoActiveForm:
MsgBox Err.Description
21. Add the following code to the Load event of the MDI Form frmMDI to
show all the MDI child forms when the application starts.
Form1.Show
Form2.Show
Form3.Show
22. On the Project menu, click Project Properties. In the Startup Object
combo box on the General tab, click frmMDI as the startup object.
How To Make A Child Form Open Up In Same X And Y Axis Inside MDI Form
I have a child form inside my MDI. every time i close this child form and open it again it opens up on different parts of mdi form. I want it always to open up on the TOP LEFTMOST corner of the MDI form. Could someone please tell me how to do that. Also how to make the second child form always open up in the middle of the screen. thanks.
Disable Resizing Of MDI Child Form & Creating Form Icon
I have two things that I want to do: -
1) How do i disable the resizing of a MDI Child/Parent form when my application is run. For example when the program is being run I want the size of the forms to remain the same size all the time, in order to do this the user should not be able to resize the forms.
2) What is the best way to create my own customized icon to put on a form? and how do i change the colour of the Forms caption bar (the bar where the icon resides on the form).
Any help will be much appreciated
Ebrahim
How To Make A Child Form Open Up In Same X And Y Axis Inside MDI Form
I have a child form inside my MDI. every time i close this child form and open it again it opens up on different parts of mdi form. I want it always to open up on the TOP LEFTMOST corner of the MDI form. Could someone please tell me how to do that. Also how to make the second child form always open up in the middle of the screen. thanks.
How To Change Properties Of The Parent Form From A Modal Child Form, Plz?
I want to open a child form windows (frmPortSetting) and from there changing some ActiveX components properties (comTx) which are on my parent form (frmMain).
I wrote code in frmPortSetting sub procedure but it seems that I can't change comTx properties directly there. (e.g. comTx.settings(9600,n,8,1)) Any advise please?
How To Change Properties Of The Parent Form From A Modal Child Form, Plz?
I want to open a child form windows (frmPortSetting) and from there changing some ActiveX components properties (comTx) which are on my parent form (frmMain).
I wrote code in frmPortSetting sub procedure but it seems that I can't change comTx properties directly there. (e.g. comTx.settings(9600,n,8,1)) Any advise please?
Accessing A Unique MDI Child Form When There Are Multiple Instances Of The Same Form ???
In the application multiple MDI child forms are created as needed. An example is as follows:
Code:Private Sub LoadNewDoc()
Static lDocumentCount As Long
Dim frmD As frmDocument
lDocumentCount = lDocumentCount + 1
Set frmD = New frmDocument
frmD.Caption = "Document " & lDocumentCount
frmD.Show
End Sub
Say that frmDocument contains some subs that I want to call from a different location and multiple instances of this frmDocument are currently in existance. I would like to execute a sub from one of these already existing forms.
I don't know how these forms are uniquely identified to address one of them. I know that the hwnd is unique when they are created but I don't know how to use that for what I want to do. I am imagining an API thing using the hwnd value? I don't want to search all the forms' captions to find the one I want - too slow for what is required - just want to directly access a particular instance of the forms subroutines
Can anyone help?
regards
Sub That Opens A Form
I have a form that asks the user which record they wish to edit. When they enter a record and hit OK I want it to open "Edit Record" (editform) Form.
A simple editform.show did not seem to work so I figured I would make a public Sub in a Module that uses editform.show and then just call it from my first form with a Call.
It goes to the public sub and then gives me a run-time error 1004: Application defined or object-defined error.
I can't get it to work. Any help? Please? This seems like it should be so easy but I can't make it happen.
Thanks
Specify Which Form Opens First
VB5.0
When I open a project, sometimes it opens to the forum layout window or to some form or module where I am not working lately.
I would expect if I am working on Form2 and save project and later return, Form2 would be open, not Form4 or module2 or the layout window, etc.
Is there any way I can specify the default open place.
Mac
Open A Child Form At The Same Record As Its Parent Form
I am trying to open a child form from a parent form, say the parent form is on record number 20. 20 is the ID number for the record. I want the child form to then also move to record number 20.
These forms are of the same table data, I just want some of the data displayed on the child form top avoid congestion.
I've looked at DoCmd.GotoRecord and DAO options. I think an ADO option is too complicated for just form data.
Thanks in advance for any help you can provide.
***RESOLVED***MDI Child Form Placement In Parent Form
I am using the MDI Parent/Child forms in my project.
I have one of my child forms open. On this child form is a command button which opens a second child form. I would like it if when the second child form is opened, it opens directly below the first child form. It would also be great if it would open below the first child form regardless of where the user has moved this form on their screen.
thank you
How To Maximize A Normal Form Similar To A Child Form In An MDI
Hi,
I have an MDI form and a child form in a Project exe
I refer to a dll which has a normal form
Through a menu option in the MDI, I have called the normal form (DLL)
While maximizing, the mdi form’s menu bar and tool bar are getting hidden
This needs to work exactly like a child form when you maximize
Could you help please?
Displaying A Child Form Without Parent Form In Backround??
I want to create a form that behaves just like Outlook mail notification. I have an application that I want to display a notify form that something has happened. I want this notify form to display centered and topmost. Once the notify form is front and center I want the ability to act on it or select another application to have notify form disappear or minimized showing it on the taskbar. Then when I select the notify form from the taskbar, it will show but NOT have my parent application show.
I can set the form on the top and have it centered. I just need help with the rest.
Thanks,
ERS
Making Notepad Application As Child Form For MDI Form
Hi
I am going trough very strange problem,however I am able to make the notepad as child form for my mdi form , but when I minimize the notepad it does not appears as our normal child form in my mdi container rather its appears as invisible.
The strange thing comes now, if the same code I used in normal form then the notepad acts the same way as normal mdichild form when it is minimized.
The code for the above is as….
Paste the below code in an MdI form having two menu’s one for calc and other for notepad
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Private Const GW_HWNDNEXT = 2
Dim mWnd As Long
Dim Pid As Long
Private Function InstanceToWnd(ByVal target_pid As Long) As Long
Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long
test_hwnd = FindWindow(ByVal 0&, ByVal 0&)
Do While test_hwnd <> 0
'Check if the window isn't a child
If GetParent(test_hwnd) = 0 Then
'Get the window's thread
test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid)
If test_pid = target_pid Then
InstanceToWnd = test_hwnd
Exit Do
End If
End If
'retrieve the next window
test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
Loop
End Function
Private Sub mnuCalc_Click()
Pid = Shell("c:windowscalc.exe", vbNormalFocus)
If Pid = 0 Then MsgBox "Error starting the app"
mWnd = InstanceToWnd(Pid)
SetParent mWnd, Me.hwnd
Putfocus mWnd
End Sub
Private Sub mnuNotePad_Click()
Pid = Shell("c:windowsNotepad.exe", vbNormalFocus)
If Pid = 0 Then MsgBox "Error starting the app"
mWnd = InstanceToWnd(Pid)
SetParent mWnd, Me.hwnd
Putfocus mWnd
End Sub
Enjoy Programming !!!
VB6 MDI Form 'bleeds' When Child Form Loaded Or Unloaded
Has anyone come across this?
I've scanned microsoft KB and here and a few other places, but no one seems to have come across this... either that, or I'm not searching for the right words...
When my program displays or unloads child forms in a MDI form, the controls are painted one at a time, and the borders of the controls look like they 'bleed' through, until everything is painted.
I've been using the LockWindowUpdate function to control some of this, but in certain cases, it doesn't seem to have an affect.
Does anyone know if there is a solution for this problem? The original program was converted from VB3 if this has anything to do with it..
Thanks,
Earl
Form Opens As Module?
Hey guys..
I have made a great form, and now when I wanted to work on it, it opens as a module? Any ideas why, and how to reverse it?
- Thediabloman -
Combo Value When Form Opens
I have a combobox which displays a list of week commencing dates from a table. It isn't bound to the table. When the form opens I calculate Monday's date based on the value of Today and this is the value displayed in the combo to start with.
Below the combo are bound controls showing data for the week selected in the combo. if I change the value in the combo the data displays for the selected week, but when the form opens nothing is displayed for the current week unless I change the date and go back to the current week.
How can I get the data to display for the week in the combo when the forms opens ? Here is my code in the combos selected index changed event.
' The following line passes the value the user selects
SqlDataAdapter1.SelectCommand.Parameters("@NetworkId").Value = Me.Label1.Text
SqlDataAdapter1.SelectCommand.Parameters("@FOW").Value = Me.WCommCbo.Text
'Fill the dataset
Me.DsEmpWeeks2.Clear()
Me.SqlDataAdapter1.Fill(Me.DsEmpWeeks2)
I tried putting this also after my code which puts the current week ending date in the combo on load but it didn't do anything.
TIA
Hiding VB Form When .xls Opens.
Hi Good people. I have another dilema. I have written some code which emails a Spreadsheet through MS Outlook when a user clicks on the Send button on the form. I created a UserForm in the VB Editor to auto fill several cells on the spreadsheet. The UserForm is needed to pop up when the Excel Spreadsheet is first opened, but after the Spreadsheet is emailed (as an attachment), I need to be able to test whether this is an initial opening or it is the attachment in the email. I don't want the UserForm to load or display in the emailed version of the Spreadsheet. Any suggestions? I have tested in the SPreadsheet's form load for the Send control (ie. If cmdSend.Visible = True Then UserForm.Show
Else UserForm.Hide End If). It seems to have a problem making the control not visible within the control's event procedure.
Thank you, DAVE
Closing A Form Which Never Really Opens
In my forms (Form2) Load function I populate all the textboxes, so from a main form (Form1) when I call Form2.PrintForm everything gets inserted correctly.
However if the user trys to do the same thing again, the data on Form2 does not get changed (b/c everything is populated on Load...and it's already loaded). Since I just call print and not show, the form never phsyically "opens"...if that makes sense.
The easiest solution would be to put some sort of close command after I call the print function
Form2.PrintForm
Form2.Close
I don't see a close function when the funciton box pops up...is there a way to call Form2.Unload from form1?
How would you handle something like this
Excel Opens, Form Shows
hi everyone!
i was wondering if you know some trick so as to make Excel show a form every time it's opened, no matter the file the user wants.
(so i guess "workbook_open" doesn't deserve to be considered)
suggestions?
thanks! >>> damkauf
Run Flash When Form Opens-RESOLVED
I was wondering how I would start a flash movie automatically when you open the form from command click on another form?
I want it to start and run until end but I do not know flash coding in the flash program, is there a way to just code it in VB to tell the flash movie to start when form has focus? It works when I run project but when it stops and I restart project it stops...in the flash properties window it has a play command that when I click play it works but then it resets itself when I restart project? I am alittle confused anyone have some code I could add to the flash window or know how to set properties window?
Thanks
A Command Button Which Opens A New Form
How do you have two forms with a command button in one of the forms that opens the other form. I just need to know the code for the command button.
Thanks for any help.
Loading VB Form When Excel Opens.
Hi good people. I was wondering how to "pop up" a VB (editor) Form when a Spreadsheet is opened. This is for auto population purposes. I know how to create the Form and auto-populate the cells, but I can't get the Form to automatically run when the Spreadsheet is opened. Any suggestions?
Thank you, DAVE
Positioning A Child Form Always In The Right Side Of The Mdi Form
I have a MDI form and a MDI child that I want to make it something like a panel in the right side of the window. So I entered code in the mdi form_resize event:
Code:
Private Sub MDIForm_Resize()
If Me.WindowState <> vbMinimized And TaskPane_Running = True Then
' resize also the right panel
frmPanel.Move Me.ScaleWidth - frmPanel.Width, 0, frmPanel.Width, Me.ScaleHeight
' frmpanel is bordless so i use lines that surrounds it
' i want the bottom line to be shown also
frmPanel.lnlBottom.Y1 = frmPanel.ScaleHeight
frmPanel.lnlBottom.Y2 = frmPanel.ScaleHeight
End If
End Sub
P.S. I have a menu, a toolbar and a status bar in the MDI Form also.
Parent Form Calling Child Form
How does a main form call a sub-form to show onscreen and begin doing what it's supposed to be doing? Do I just use
frmSecond.Show ? Or do I have to Call the form?
Accesing The MDI Parent Form From A Child Form
Hello, It's the firs time I work with MDI and I don't know how to acces controls or properties for the MDI parent form form within the code of a child form.
2 examples.
I have a MDI parent form called frmMain, on this form I have a Status Bar control called StatBar, form the code of a child form I want to modify the text on one panel of the status bar like this:
Code:
frmMain.StatBar.Panels(3).Text=Str(XX)
but this don't work,
also I want to read the property for the Parent form like:
Code:
if me.width > frmMain.Width then
me.Width=frmMain.Width - 100
end if
and this doesn't work either,
How can i do this?
MDI Parent Form, Using Menus From Child Form
I have managed to do this before, but can't remember what properties I need to set so that when I select a child form the MDI forms menu has the child forms menu on the right of it's own menu... Does that make sense?
At the moment, when I select a child form, the MDI forms menu is replaced with the child forms...
It's going to be one of those days!
Making A Child Form Not Move Within A MDI Form
How can you make a form not move within another form. I have created an Outlook type toolbar and I wish for it not to move within my MDI form. How is this done?
Thanks in advance,
Jeff
|