Get connector from shape reference

O

OneSHOT

Hi

I have a VB.Net solution using the visio activeX control and would like to
know of a way to return the connector(s) that is connected to a shape that i
have a reference to, any help would be greatly appreciated.

TIA

OneSHOT
 
C

Chris Roth [MVP]

Hi 1,

Yes, the Visio object model sometimes seems a bit backwards with regards to
connections. At first glance, it seems you need to find which connectors are
connected to which shapes.

To do what you want to do, try these tips:

- Use visShp.FromConnects. This tells you what is glued to the shape.
(On the other side, a connector would have a Connects collection...)
- For each FromConnects, you have a Connect object.
- visConn.FromSheet is the connector.
(Tip: with connection objects, the thing that has Red Handles is the
FromSheet)
- visConn.ToSheet is the shape you started with.

You can check FromSheet for things such as OneD, or Master to see if it's a
"1-D style connector" (ie: point to point gluing shape), or if the master is
the "Dynamic Connector".

That should get you started,

Chris Roth
Visio MVP

www.wanderkind.com/visio
 
O

OneSHOT

That worked great to get the connector! but i now seem to have a problem
getting the shape above so far i have tried

c = shp.VisioShape.FromConnects(1)
c.FromSheet.FromConnects(1).FromSheet

and other variations which all produce the same error message

.... Invalid Parameter ...

on checking it seems that c.FromSheet.FromConnects Collection contains no
values.

Again Thanks in advance

OneSHOT
 
O

OneSHOT

Ignore that last post i didn't read Chris's post fully it seems the code
would be

c = shp.VisioShape.FromConnects(1)

c.FromSheet.Connects(x).ToSheet

Cheers

OneSHOT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top