CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    37

    Dynamic Insertion of Textboxes

    Hi,

    I've been trying to learn enough to develop the family tree diagram and making progress.

    There is a nice drawing project at: http://www.vb-helper.com/howto_net_d...framework.html

    It illustrates many of the drawing, saving, re-opening, editing, drag/drop features that the family tree diagram would need, and is a good starting point.

    To adapt this for the project, after searching for snippets online, I've tried to add dynamic insertion of a label as a start (eventually, it should be a textbox that the user, in runtime, can enter text into, save, re-open, edit). But, I can't get this to work. No errors display, but I must be doing something wrong.

    Here's the label code which I've so far appended at the end:

    Dim counter As Integer = 1
    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim lblTask As New Label
    lblTask.Name = "Label" & counter
    lblTask.Size = New Size(150, 20)
    lblTask.Location = New Point(500, counter * 22)
    lblTask.Text = "txtDescription.text"
    Me.Controls.Add(lblTask)
    counter += 1
    End Sub
    End Class

    Unfortunately, as a beginner, I suspect it is conflicting with the other code.

    I would appreciate any help to get dynamic insertion of textboxes (including saving, re-opening, editing) working.

    Thanks very much for your help.

    Regards,
    saratogacoach

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Dynamic Insertion of Textboxes

    Firstly you've been around long enough to know to use CODE tags.... PLEASE USE THEM....

    The first thing i noticed is that this line is wrong..
    Code:
    lblTask.Text = "txtDescription.text"
    it should be
    Code:
    lblTask.Text = txtDescription.text
    further i can say......
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Dynamic Insertion of Textboxes

    You need to set the visible property to true or it will not display.
    Always use [code][/code] tags when posting code.

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

Featured