Results 1 to 4 of 4

Thread: TextBox in Structure

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philadelphia
    Posts
    47

    TextBox in Structure

    Does anyone know how to create a structure that includes a textbox... so that when i create a new instance of the structure, i can create a new textbox.

    IE.
    Code:
    structure newTextbox
       dim txtBox as textbox
       dim isMovable as boolean
    end structure
    
    sub someSub()
      dim x as newTextbox
      me.controls.add(x.txtbox)
    end sub
    U S A
    Visual Studio .NET
    Windows XP

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    That should work, you just need to instantiate the textbox object before adding it to the form.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    in addition to master crptcblade
    VB Code:
    1. option strict on
    2. imports system
    3. imports system.windows.forms
    4. public class example
    5.    inherits form
    6.    
    7.    structure newTextBox
    8.       dim t as textbox
    9.       dim i as boolean
    10.    end structure
    11.    
    12.    sub new()
    13.       dim x as newTextBox
    14.       [i]x.t=new textbox()[/i]
    15.       me.controls.add(x.t)
    16.    end sub
    17.    
    18.    shared sub main()
    19.       application.run(new example())
    20.    end sub
    21. end class

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philadelphia
    Posts
    47

    Thanks

    Thank you for the replies... I found that I could create a sub in the structure that called a new textbox. So i did it as follows.

    VB Code:
    1. structure example
    2.     dim txtBox as textbox
    3.     dim x as integer
    4.     sub setup
    5.         txtbox = new textbox
    6.     end
    7. end structure
    8.  
    9. sub main()
    10.     dim ex as example
    11.     ex.setup
    12.     me.controls.add(ex.txtBox)
    13. end sub

    I was also debating on weather or not to create a new class.
    U S A
    Visual Studio .NET
    Windows XP

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