Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2003, 03:57 PM
Registered User
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Controls

Hi,

I am building a simple drag and drop interface to drop controls such as Textbox, Checkbox and Label onto a Frame. My code works fine for the textboxes and checkboxes but for the labels they get dropped behind the form, even though I the code is the same for each control (roughly) and the z-order is changed to put it in front (ie sitting on top but the form is the container not the frame). Any help would be great, Seem to be going round in circles;

Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
...
    If TypeOf Source Is Label Then
        lblLabel(Source.Index).Top = Y
        lblLabel(Source.Index).Left = X
        If Source.Index = lblLabel.Count Then
            Load lblLabel(lblLabel.Count + 1)
            With lblLabel(lblLabel.Count)
                .Visible = True
                .Top = 1080
                .Left = 6960
                .ZOrder 0
                .Caption = "Label" & lblLabel.Count
                .Tag = lblLabel.Count
            End With
       End If
    End If
...
End Sub
 
Old June 26th, 2003, 11:00 AM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You didn't do anything wrong with the code. The Label can't be display on top of other control . (I think it's doesn't have the hWnd property) You could always replace the Label by and other control or create a User Control with the Label in it. They can be more solution to this problem, but it's the 2 I can think of for the moment.

Hope it help you.

Stéphane
 
Old June 26th, 2003, 12:54 PM
Registered User
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Dynamic Controls rhd110 General .NET 1 July 22nd, 2007 04:23 AM
dynamic controls - referencing keyops VB.NET 0 February 14th, 2006 03:50 PM
Create dynamic controls saulodet C# 2 November 21st, 2003 12:36 PM
Dynamic Controls [xx(] koneruvijay VS.NET 2002/2003 0 November 12th, 2003 12:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.