Results 1 to 3 of 3

Thread: Embedding forms within a Tab Control

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    San Diego - California
    Posts
    251

    Talking

    One of the problems I am experiencing when using a tab control is that the coding get un-manageable as every tabs code is in the same form. (Any other ideas?)

    I have a number of existing forms that I would like to embed in the tab control. Obviousely these forms must be in a modeless format. I can successfully do this using the SetParent command (user32.dll) but the problem comes in when I try to shut my User_Control down from vb. The system crashes, and I think that the problem is that I am using modeless forms.

    This code works well if I shut the user-control down from the app - but if I shut it down from vb it crashes. By making frmOnDisplay a modal form the crashing does not occur.

    Private Sub UserControl_Terminate()
    ' 'Make sure that you have closed the displayed form
    If lngParent > 0 Then
    Unload frmOnDisplay
    End If

    'Disconnect connection
    Set adCON_Maint = Nothing
    End Sub

    I would appreciate any help/suggestion.


  2. #2
    Addicted Member Shrog's Avatar
    Join Date
    Aug 1999
    Location
    Darkest Africa
    Posts
    186

    Talking Classy

    You cannot really use a form, because is cannot be contained inside a container, so you could use the next best thing - a picturebox. Pictureboxes are based on the same class as forms, so they use about the same level of resources. But you could go even lighter and use frames instead.

    Now if you think about it (simplisticly), a form is just a gloryfied picturebox with a coding module attached to it. So you can "make" your own, using a class module.

    For each tab, add another class module to your project. Each class will have a picturebox (or frame, depending on what you decide to use). Now you can have all the coding pertaining to that picturebox in its own class module. All you have to do is to set the parent of the picture box to the appropriate form, and you're off.

    Regards
    Shrog

  3. #3
    Lively Member
    Join Date
    Nov 2000
    Posts
    88

    Unhappy

    Hi.

    I am using the SmartUI to produce an outlook type GUI for my current project.

    I want to create the effect of 'frames' that you would get from a website, but by using a container and picturebox.

    Does anyone have any code which would show me how to do this. I already have some normal forms which I would like to somehow import into the picture box to get it to work. I read the previous emails, but I am not a clued up programmer and dont know how to use class modules!

    Thanks in advance for you help,

    Paul Grimshaw.

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