Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 3rd, 2007, 10:10 PM   #1
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 245
Rep Power: 1 Jabo is on a distinguished road
MDI applications in VB6.0

Hi,
My name's Jim, new to forums.

Now, down to the problem I'm having. I've created an MDI form, and have 2 child forms in my application thus far. I can get the one form that acts as my main form to show, and figured out how to put the form where I want it. The second form I don't want to show until the user clicks the appropriate menu item. This is where the problem lies.

I can't get the form to load no matter what I've tried. I run the program in Vstudio, and can see the form has focus in the project explorer, but it doesn't show. I've tried to move the form to MDI.top MDI.left, it doesn't show. I've minimized the main form and it minimizes. I've tried hiding the main form and it doesn't hide. I've tried showing the 2nd form from the MDI Load function, from the main form Load function and nothing.

I've scoured my text book, which is horribly lacking in information other than this is how you create an MDI form and child forms. Nothing that tells you how to manipulate forms. I've searched the MSDN website and everything they have on MDI is pretty much the same thing. Is there something painfully obvious that I'm missing?:eek:

Also of note, I've made Windows menus on each form, and when I try loading the 2nd form, the Windows menu isn't there. If I go back to the main form and view the Windows, the main form is the only one listed. It's like the form isn't loaded, but yet it has the focus in project explorer.

If you need some code I can provide it. And I appreciate ANY help you guys can give. I've also searched these forums before posting for MDI and found 1 post, which still didn't answer my question.

Last edited by Jabo; Sep 3rd, 2007 at 10:21 PM. Reason: More intangible information
Jabo is online now   Reply With Quote
Old Sep 4th, 2007, 12:34 AM   #2
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 296
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
So your MDI form will show up, and so will one of the MDI Child Forms right, but the second one won't. Am I following you so far? Post the code for making the form show that you are currently having problems with. I dont remember cause I haven't done vb6 in awhile, but does the form have a visible property. If it does make sure it is set to visible.
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain

Destruction leads to a very rough road, but it also breeds creation.
bigguy is offline   Reply With Quote
Old Sep 4th, 2007, 12:59 AM   #3
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 245
Rep Power: 1 Jabo is on a distinguished road
MDI Form code

Private Sub MDIForm_Load()
    frmLogin.Show
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
    If MsgBox("Are you sure you want to exit?", vbQuestion + vbYesNo, "Confirm Exit") = vbNo Then
        Cancel = 1
    End If
    Dim frm As Form
    For Each frm In Forms
        Unload frm
    Next
End Sub

Main Form code

Private Sub Form_Load()
    With Me
        .Top = 0
        .Left = 0
        .WindowState = 2
    End With
End Sub

Private Sub mnuExit_Click()
    End
End Sub

Private Sub mnuTapeEntry_Click()
    With Me
        .WindowState = 1
    End With
    frmTapeEntry.Show
End Sub

Child Form code

Private Sub Form_Load()
    With Me
        .Top = 0
        .Left = 0
    End With
End Sub

The main form and child form are both MDI child forms. Both are also visible.

Last edited by Jabo; Sep 4th, 2007 at 1:16 AM.
Jabo is online now   Reply With Quote
Old Sep 5th, 2007, 6:20 AM   #4
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 245
Rep Power: 1 Jabo is on a distinguished road
Well, after letting the problem cure for a day, I ran the program again just for giggles, and it worked. The only explanation I can come up with is maybe I hadn't saved the one form yet, and that's why it wouldn't load. Thanks for trying to help bigguy.

I guess maybe I should do a build from now on before trying to run my programs.
Jabo is online now   Reply With Quote
Old Sep 6th, 2007, 5:20 PM   #5
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 314
Rep Power: 4 mackenga is on a distinguished road
That's kind of weird behaviour. But you'll get used to it with VB. I maintain embedded systems (quality assurance systems in production lines) for a living. Appallingly, these are all VB6 apps. Yesterday I had done about three hours worth of editing, stripping out old dead code that never gets called, fixing a few subtle but nasty issues and adding the feature I was supposed to be adding. I ran the code and set a breakpoint in a routine that was doing some database access, then when it hit the breakpoint stepped into the part where it opened the recordset. Curious as to one of the field values in the first record retrieved, stupidly I asked for it in the immediate pane, and the VB IDE promptly puked on its shoes and lost my work for me.

Another nice one is if you right click a call to a Sub or Function defined in a UserControl and choose "Definition" it gives you a message about it being impossible to jump to that on the grounds that it's hidden. Of course it isn't really, but you have to 'walk there'.

VB6 is a tired old pain the arse. I love my job. I recommend C.
__________________
"I'm not a genius. Why do I have to suffer?"
mackenga is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PFO Links within applications. john Wesley Coder's Corner Lounge 5 Aug 1st, 2006 9:14 AM
Placing external applications within an mdi form? ZeeMan Visual Basic 1 Jul 19th, 2006 2:16 PM
Can PWS be efficient in Internet applications? sham Other Web Development Languages 1 Nov 19th, 2005 8:12 AM
controlling another applications window(Maximise/Minimise) timethyfx Other Programming Languages 0 Jul 24th, 2005 2:06 AM
Programing Graphic Applications Navid C 10 Jul 3rd, 2005 10:56 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:23 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC