Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Re: Can I create objects run-time? (eg a textbox) SOLVED IN THIS WAY


Message #1 by "Alessandro Bernardi" <abernardi@b...> on Fri, 17 Jan 2003 00:58:55 +0100
You need to move them from top left of the window and make them visible. They're not visible by default,
presumably so you don't get a flash. As it were.

Ian
  ----- Original Message ----- 
  From: Alessandro Bernardi 
  To: professional vb 
  Sent: Thursday, January 16, 2003 11:58 PM
  Subject: [pro_vb] Re: Can I create objects run-time? (eg a textbox) SOLVED IN THIS WAY


  I just tried this code, having on the form just a textbox [tb(0)] and a
  command button [command1]
  No errors... but no new textboxes...
  I also tried this: tb(r) = tb(r - 1) to set all the properies, but I think
  it makes equal the default one (text).

  Private Sub Command1_Click()
      For r = 1 To 3
          Load tb(r)
          tb(r) = tb(r - 1)   'to have the same properties...
          tb(r).Top = tb(r - 1).Top + tb(r - 1).Height    'to move it down the
  form
      Next
  End Sub

  -------------
  SOLUTION
  -------------

  The only thing i needed to do more is to set
              tb(r).visible = true
  and then... :D new textboxes!!!

  ----------------------------------------
  THANKS A LOT TO EVERYBODY
      your help has been indispensable!
  ----------------------------------------
  Ale.

  ----- Original Message -----
  From: <Deva_Joseph@a...>
  To: "professional vb" <pro_vb@p...>
  Sent: Friday, January 17, 2003 12:07 AM
  Subject: [pro_vb] Re: Can I create objects run-time? (eg a textbox)


  >
  >
  > Create a Textbox in design time (set the index to 0), and in run time,
  > redim it to the desired number and load each.
  >
  > Thanks and Regards,
  > Deva
  >
  >
  >
  >
  > "Alessandro Bernardi" <abernardi@b...> on 01/16/2003 02:55:36 PM
  >
  > Please respond to "professional vb" <pro_vb@p...>
  >
  > To:    "professional vb" <pro_vb@p...>
  > cc:
  > Subject:    [pro_vb] Can I create objects run-time? (eg a textbox)
  >
  > In example I don't know how many textboxes I need for my application and I
  > would like to draw my form once defined how many I need.
  >
  > How can I do? (either in vb6 or vb.net)
  > with vb6 I tried using an array of textboxes... something like this:
  >
  >     for r = 0 to 9
  >         dim tb(r) as new textbox
  >         tb(r).top = r * 10
  >         rb(r).height = ...
  >         ...
  >     next r
  >
  > but... nothing... why?
  >
  > So I tried to put a well defined textbox (tbGood)
  >
  >     dim tb(r) as new tbGood
  >
  > but...
  >
  > is there a way to do that?
  > Now I'm migrating to vb.net and I (sadly) can't use the objects' array (or
  > probably it's a fault of mine, but i think i should use old object that
  are
  > ther just for compatibility)
  >
  > thank you in advance.
  > Ale.
  >
  >
  >
  >
  >
  >
  >
  >
  >
  >
  >
  >







  Return to Index