Results 1 to 7 of 7

Thread: Creating forms at runtime

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Simply put, what I want to have is something that will work the same as the Data Form Designer in VB. I want to be able to create the form, create the text boxes and labels, and set all the properties. And it must all be based on user defined variables (such as: the fields they want displayed, what table to use, etc.) Please help, I know this is a huge task, but that's what I need.

    ------------------
    Thanks,
    Ryan
    corneslen@hotmail.com
    ICQ# 47799046

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170

    Post

    It can be done, but not easily. The easier way to do this is have an create an array of an object and make its index 0. The other way involves much more code. I'd go with option 1 if you can.

    Phil

  3. #3

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    What do you mean when you say "create an array"? I am interested in your idea, because I like the idea of little code. But could you please explain it better, I don't understand what you mean.

    ------------------
    Thanks,
    Ryan
    corneslen@hotmail.com
    ICQ# 47799046

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    What Philip is saying is not actually creating the form from scratch, but rather create another instance of the existing form.

    Code:
       Dim frm As New Form1
    
       frm.Show

    Regards,

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com



  5. #5

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    So what you mean is to create all the different possible forms at design time and then just show the form that fits what the user inputs as the criteria? Did I understand you correctly? Is that what you were saying?

    ------------------
    Thanks,
    Ryan
    corneslen@hotmail.com
    ICQ# 47799046

  6. #6
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    Post

    Well, I think you want something like this:

    1. Create a form. 2. Create textbox
    3. Insert data into the textbox and save them

    if that is the point use this, after create the form as you know

    DIM ctlWname as object
    set ctlWname=frmForm.Controls.Add("VB.Textbox")
    with ctlWname
    . visible=true
    .top= x 'Your top Position
    .Left=x 'idem
    .width=x 'idem
    .height=x 'idem
    .font.size= fx 'your font size
    end with

    Anyway this solution in on MICROPress Distributed Applications For Microsoft Visual Basic 6.0 MCSD Training Kit. ISBN 0-7356-0833-4

  7. #7
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Take a look at the Code snippet I posted for the similar question.


    Regards,

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com


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