|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Removing object from Form
I can't get the win api beep command to work reliably on my computer so I am trying to use the mci commands to play a wav file. The example I have is very detailed and long and I want to simplyfie it. How do you remove a command button(or other object) from the source code in a form once the program is finished?
![]() |
|
#2
|
|||
|
|||
|
U can try controls.add method:
Option Explicit Dim objctl() Sub addcontrol(ProgID As String, Name As String, Index As Long) Set objctl(Index) = Controls.Add(ProgID, Name) End Sub Sub reducecontrol() Dim i As Long For i = 1 To 10 Set objctl(i) = Nothing Next End Sub Private Sub Form_Load() Dim i As Long ReDim objctl(1 To 10) For i = 1 To 10 Call addcontrol("VB.CommandButton", "CMD" & CStr(i), i) objctl(i).Caption = "OK" objctl(i).Visible = True objctl(i).Left = i * objctl(i).Width Next End Sub Private Sub Form_Unload(Cancel As Integer) Call reducecontrol End Sub Plz visit http://www.oreilly.com/pub/a/oreill...on/dynamic.html |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Removing object from Form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|