Dynamic control creation and calling DOS programs from VB. 
Author Message
 Dynamic control creation and calling DOS programs from VB.

I am wondering how to create controls at runtime in Visual Basic 5. Is
this even possible? Do I have to use ActiveX or soemthing? The controls
I wish to create are simple slider bars.

Also, is there a way to call an MS-DOS program from within a VB5
program?

Thanks in advance!
Alex Magidow

--
You Know You've Been Raytracing Too Long When:
 You buy a trig. Textbook, in the hopes of learning new raytracing
secrets



Tue, 19 Feb 2002 03:00:00 GMT  
 Dynamic control creation and calling DOS programs from VB.


Quote:
> I am wondering how to create controls at runtime in visual basic 5. Is
> this even possible? Do I have to use ActiveX or soemthing? The
controls
> I wish to create are simple slider bars.

> Also, is there a way to call an MS-DOS program from within a VB5
> program?

> Thanks in advance!
> Alex Magidow

> --
> You Know You've Been Raytracing Too Long When:
>  You buy a trig. Textbook, in the hopes of learning new raytracing
> secrets

I'd like dynamic control creation myself. So far, it seems impossible.
One often-mentioned work-around is to create a slider-bar at design
time, and set its Index property to zero. This creates a control Array
of Slider bars, which you CAN add to at runtime.

Also, in VBA, you can add a control like this:

    Dim mycmd As Control

    Set mycmd = MForm.Controls.Add(strControl)
    mycmd.Left = intLeft
    mycmd.Top = intTop + 20 * intCount
    mycmd.Width = intWidth
    mycmd.Height = intHeight

    If strCaption <> "" Then
        mycmd.Caption = strCaption
    End If

    mycmd.Visible = True

Unfortunately, it doesn't work in Visual Basic.

To your second question, you can execute DOS commands like this:

Private Sub mnuDosPrompt_Click()
'   ChDrive Drive1.Drive
    Dim i
'   ChDir Dir1.Path
    i = Shell("C:\Command.com", 1)
End Sub

The above Sub Just opens a DOS window, but you can substitute other DOS
commands where it says "C:\Command.com".

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sun, 24 Feb 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Dynamic creation of web controls in VB.NET

2. Licensing VB Controls for Dynamic creation at runtime

3. Dynamic Controls Creation and Referencing the new Control.

4. Dynamic Control Creation, Controls object has no .Add ???

5. Help: How to call DOS program from VB Application

6. Dynamic Control Creation - Expand Form?

7. Dynamic Creation of Controls

8. Dynamic control creation

9. dynamic creation of controls?

10. VB6-Dynamic Control Creation

11. Dynamic control creation-HOW???

12. Dynamic creation of Control Array on a SSTab

 

 
Powered by phpBB® Forum Software