
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.