code; no workie, workie for creating a dynamic control

I’m trying to create several dynamic controls with in a Webcontainer.
The Code takes an object that has been already created on the Webcontainer ( by dragging and dropping from the IDE), and then tries to copy that object x number of times.
The Code works, kinda sort of, it only duplicates the object once.

The object is a ‘Super’ of the webimageview class

any idea on what I’m doing wrong??? Other than it doesn’t work :slight_smile:
I’m on 2012 R2.1
Thanks to all who help!

  if session.opend = false then  //opend is a method in session, that connects to a DB
    //TODO: display error
  elseif Session.opend = true then
    session.SQL  = "SELECT Test.menuName, Test.menuPKI FROM test" = session.db.SQLSelect(session.SQL)  // "rs"  property in session of Recordset
   //TODO: db error checking    

    dim x as integer // to shift Dynamic control left by 112
    x = 9  // start with 9

    for i as integer = 0 to
      if then  //EOF = true , exit out
      msgbox("menuName"))  //Msgbox Display's the field correctly on every pass
      // -----      Code below; Trying to duplicate an already existing object in the WebContainer --
      //-----      Only displays the object, once
      // -----     Tried the code with a normal webimageview, same results
      dim dynamicControl as new myImageviewClass
      dynamicControl = myImageviewClass1
      dynamicControl.Left = x = 32
      dynamicControl.Visible = true
      dynamicControl.Enabled = true
      x = x + 112  //shifting by 112 every iteration of the FOR/NEXT

dont try to copy an existing control on the WebPage. Create a new one from scratch like this:

dim w as new myImageViewClass w.embedWithin(self,x,32,w.width,w.height)

Hi Greg, thank you for your quick reply

can you do an ‘embedWithin’ within a WebContainer control?

I understand what you are trying to tell me, and yes that would work with a webpage.

none the less, thank you for the reply!


Hi Greg, i don’t understand.
i have try to create e new WebContainer (name wcA)
how can i dynamically add a lot of webTextBox to wcA ???
i have tried to :

put webTextBox (name wTxt1) in wcA (webContainer) then i write this code in event
dim newTxt as new wTxt1
but this produce an error

then i have tried to made a class with super WebTextField named txtClass1
in i have put this code
dim newTxt as new txtClass1
but this produce another error

i don’t understand how can i dynamically add controls to webContainer …
can you help me please ?
thank you j.b.

Create a WebContainer subclass that has the control in it that you want to add dynamically. Then in code, create an instance and call EmbedWithin on that.

ok i have tryed and it is ok, tnx Greg