Results 1 to 12 of 12

Thread: Load a form in a frame?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    US
    Posts
    102

    Load a form in a frame?

    Is there anyway I could load a form in a frame? Or is there an easier way to do this? Should I just hide the forms and just have them visible at the exact same site?

    aka this is what I want to do: I have many forms and outputs etc. So there would be one screen and the user clicks a button and a form loads in an area on the screen, then clicks another and loads outputs or graphs. Does that make since?

    Would it be faster (running time wise) to just have everything hidden, or load up when needed, or something else.

    Thanks

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    I have the code for putting forms in picturebox. It's in attachment.
    You said you want to put it in frame - i don't know if it's possible. However I believe it's a way to do it if control has .hwnd and .hdc properties. Maybe!
    I suggest you use picturebox instead of frame. It doesn't have a frame around it, but it can be done with api (search for DrawEdge function).

    The code is not mine. I found it on the net. It is a wizzard class (for creating custom wizards). Check it out.
    Attached Files Attached Files
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    US
    Posts
    102

    Talking

    Zvonko
    -well do, Thanks.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    US
    Posts
    102
    sorry to bother you, but do I need to set any references? I get an error when I try to run it. I can prob figure it out, its well documented so thanks!

  5. #5
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    I think there's no references to set.

    What error do you get?
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    US
    Posts
    102
    The error was about the user-defined type not defined.
    highlighting the code below under the iwizardpage code.

    Public Sub BeforePageShow(Wizard As frmWizDodajMain, ByVal CurrentStep As Integer)

    '// This method is called each time the wizard is about to show
    '// the page.


    End Sub

    I should just be able to open wizard.vbp

    There is also a wizard.vbw and cwizard.f2x that windows didn't pick up as anything. Maybe I need to download or configue something else. Sorry about this, thanks for all the help

  7. #7
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    I tried using the SetParent API function to add a 2nd form to the frame in the main form once. It worked ok but the form lost it's border. Looked funky.

    The sample below requires a statusbar with 4 panels....a commandbutton, textbox and a progressbar. (nice demo of a progressbar in the statusbar if nothing else)

    VB Code:
    1. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    2.  
    3. Private Sub Command1_Click()
    4. Dim l As Long
    5.  
    6. For l = 0 To 10000000
    7.     If (l Mod 100000) = 0 Then
    8.         ProgressBar1.Value = l / 100000
    9.     End If
    10. Next
    11. ProgressBar1.Value = 0
    12. End Sub
    13.  
    14. Private Sub Form_Load()
    15. SetParent ProgressBar1.hWnd, StatusBar1.hWnd
    16.   With StatusBar1
    17.     ProgressBar1.Move .Panels(4).Left, 50, .Panels(4).Width - 30, .Height - 65
    18.   End With
    19.   SetParent Text1.hWnd, StatusBar1.hWnd
    20.   With StatusBar1
    21.     Text1.Move .Panels(1).Left, 50, .Panels(1).Width - 30, .Height - 65
    22.   End With
    23. End Sub

  8. #8
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Now I see it.

    I believe it's my mistake 'cause I was tampreing with the code...

    Try to rename main form to "frmWizDodajMain" or change all "frmWizDodajMain" in code to name of the main form.
    I think that'll help.
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    US
    Posts
    102
    Let me make sure I got this clear: rename the CWizard form to frmWizDodajMain Thanks again

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    US
    Posts
    102
    It worked, it will help me out alot, so thank you!

  11. #11
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    You're welcome.

    I'm glad i could help..

    Just curious: What kind a program are you doing?


    Oh, yes, would you do a favour for me? I recently posted a thread (that is annoying me) - I don't know how to make a tree out of text list of files. Here's the address: http://www.vbforums.com/showthread.p...threadid=97701
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Location
    US
    Posts
    102
    zvonko-
    I'll check out your question but I know nothing on VB. The progam is this: There are five forms the user fills out; Then more forms with adjustable values. Takes all the answers puts them into the excel sheet then the output is just a matter of calling info from the excell sheet.

    I have never programed in VB but have in other languages but nothing like this. So I'm slowly but surely going to get this thing done. Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width