Assigning form names to variables


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Assigning form names to variables

  1. #1
    sunil911 Guest

    Assigning form names to variables


    I am retrieving form names of a VB project from a table in a recordset and
    I want to be able to load those forms one at a time. My problem is that I
    am unable to assign the name to a form variable. It always gives me a type
    mismatch. I declare it as
    public frm as form

    set frm = rs(0)

    Load frm

    However, it seems to give me a type mismatch error. Is there a way to do
    this? Someone pls help with a code snippet. Thanks.

  2. #2
    Kalpesh Guest

    Re: Assigning form names to variables



    Sunil,

    Try using as below which will help

    do while not rs.eof()
    forms.Add rs.fields("formnamefield").value
    rs.movenext
    loop

    this way all the forms will get added to forms collection
    & then u can load the form depending upon your choice
    dim x as string
    x="form3"
    e.g forms(x).show

    hope this solves your problem,
    Kalpesh

    "sunil911" <sunil911@hotmail.com> wrote:
    >
    >I am retrieving form names of a VB project from a table in a recordset and
    >I want to be able to load those forms one at a time. My problem is that

    I
    >am unable to assign the name to a form variable. It always gives me a type
    >mismatch. I declare it as
    >public frm as form
    >
    >set frm = rs(0)
    >
    >Load frm
    >
    >However, it seems to give me a type mismatch error. Is there a way to do
    >this? Someone pls help with a code snippet. Thanks.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center