Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old September 26th, 2003, 08:08 PM
Zooker Zooker is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 9 Zooker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old September 27th, 2003, 12:07 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via MSN to cleverpig
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Removing object from Form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway