2 questions


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: 2 questions

Hybrid View

  1. #1
    mohamed CHAABANE Guest

    2 questions

    Hi all
    I have two questions :

    1- I want to add code to a new control witch is added at run time. It'is
    possible ?

    2 - Is there a way for adding a form to a project without recompiling it.


    Best Regards
    Mohamed CHAABANE



  2. #2
    Adrian Forbes Guest

    Re: 2 questions

    > 1- I want to add code to a new control witch is added at run time. It'is
    > possible ?


    No

    > 2 - Is there a way for adding a form to a project without recompiling it.


    No



  3. #3
    Sam Barrett Guest

    Re: 2 questions


    "mohamed CHAABANE" <mobanne@hotmail.com> wrote:
    >1- I want to add code to a new control witch is added at run time. It'is
    >possible ?
    >
    >2 - Is there a way for adding a form to a project without recompiling it.


    The answer to both of your questions is no, but you can make it appear to
    be yes. Adding to the code for your previous question, “Name form in a text
    variable,” create a form with two text boxes and a command button. This
    form is your generator: Text1 has the “name” (actually just the caption)
    of the generated form, Text2 has the number of text boxes to place on the
    generated form. If a form with the caption in Text1 has been loaded, it
    is shown; otherwise a new form is created. Here is the code for Form1, the
    generator:

    Option Explicit

    Private Sub Command1_Click()
    Dim f As Form
    Dim fNew As Form2
    For Each f In Forms
    If f.Caption = Text1.Text Then
    f.Show
    Exit Sub
    End If
    Next f
    Set fNew = New Form2
    fNew.Caption = Text1.Text
    fNew.Show
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    Dim f As Form
    For Each f In Forms
    Unload f
    Next f
    End Sub

    Form2 is a prototype for the form to be generated. It has a single textbox
    with the index property set to zero so that I can load more textboxes. Here
    is the code for Form2:

    Option Explicit

    Private Sub Form_Load()
    Dim i As Integer
    Text1(0).Top = 0
    For i = 1 To Val(Form1.Text2.Text) - 1
    Load Text1(i)
    Text1(i).Top = 600 * i
    Text1(i).Visible = True
    Next i
    End Sub

    Hope that this is a help. –Sam



  4. #4
    Marc D'Aoust Guest

    Re: 2 questions

    Depending on what you want to do, you might be able to dynamically generate
    and execute code using the Microsoft Script Control. You can concatenate
    some VBScript code into a string and then pass it to the control to be
    executed. You can even pass objects to the control and use them in your
    script code.

    Hope this helps.

    --
    Marc D'Aoust
    Director of Research and Development
    OSTNet OpenSource Technologies Inc
    mailto:marc@ostnet.com





    "mohamed CHAABANE" <mobanne@hotmail.com> wrote in message
    news:3961d26e@news.devx.com...
    > Hi all
    > I have two questions :
    >
    > 1- I want to add code to a new control witch is added at run time. It'is
    > possible ?
    >
    > 2 - Is there a way for adding a form to a project without recompiling it.
    >
    >
    > Best Regards
    > Mohamed CHAABANE
    >
    >




  5. #5
    Michael Culley Guest

    Re: 2 questions


    Mahamed,

    Can you explain what you are trying to do?

    Michael Culley


    "mohamed CHAABANE" <mobanne@hotmail.com> wrote:
    >Hi all
    >I have two questions :
    >
    >1- I want to add code to a new control witch is added at run time. It'is
    >possible ?
    >
    >2 - Is there a way for adding a form to a project without recompiling it.
    >
    >
    >Best Regards
    >Mohamed CHAABANE
    >
    >



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