Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

DDE without a control.

I'm trying to create a class module that encapsulates some dde commands that I use to interact with an older program.  However, I need a control like a label or textbox in order to have dde functionality, and as far as I can tell, these cannot be created through code alone.  Passing a reference to such an object works, but is crufty.  

Is there any way to create one of these objects through code alone?  I know you can add to an existing control array, but I want a completely new instance.  I've tried

Dim something as New Label

which gives the error "Invalid use of New keyword".  

Alternatively, is there a way to use DDE that isn't attached to one of these controls?  I've seen http://www.angelfire.com/biz/rhaminisys/ddclient.html commercial DDE classes that seem to do something similar, so it must be possible.
0
LastToKnow0
Asked:
LastToKnow0
  • 2
  • 2
1 Solution
 
nichiaCommented:
'Adding a control to the form during runtime
Dim myControl As Control
Set myControl = Me.Controls.Add("VB.Label", "myControl")
myControl.Visible = True
myControl.Caption = "DDE Label"
0
 
LastToKnow0Author Commented:
Is there a way to do this from a class module, or code that is not attached to a form?
0
 
nichiaCommented:
As far as I know, there is no way to have a Label or TextBox control reside outside a form.

You may have to use the DDE API to do this.

Here is a reference which I will look at now too:

Perform Interprocess Communication
Using the DDE Management Library

http://www.thescarms.com/vbasic/DDEML.asp
0
 
LastToKnow0Author Commented:
Oy, that looks complicated.  On the other hand, it seems to do exactally what I need.  Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now