Visio Guy

Visio Discussions => Programming & Code => Topic started by: Jon Gottlob on April 01, 2014, 08:47:30 PM

Title: Update an existing parking lot visio document in VB.Net.
Post by: Jon Gottlob on April 01, 2014, 08:47:30 PM
Greetings,

I have existing visio documents that contains the layout of various parking lots and their numbered parking spaces.  My task is to add the person assigned to the parking space based on data in a SQL Server database.

This would be done in VS2010, using VB.Net.

I haven't done anything along these lines before, but I'm experienced in VB.Net, just not integrating the Visio side of it.

Any suggestions on where to start?


Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: aledlund on April 01, 2014, 09:01:32 PM
without seeing an example of the documents, it would be very hard.
al
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jon Gottlob on April 01, 2014, 09:23:00 PM
For each of the labeled parking space - there is an employee name associated with it in a SQL server table, based on the spot name - for example - "A-01" is associated to "Bud Henderson".

---------------
A-10 Bud Henderson
---------------
A-11 Steve Smith
----------------
A-12 Byron Nelson
----------------

In the visio document, the names do not appear and that is the what I'm trying to accomplish, adding the names from the DB into the Visio document in the correct spot.
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jon Gottlob on April 01, 2014, 09:46:55 PM
Attached is an image of one of the visio parking lots.

Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jumpy on April 02, 2014, 06:50:37 AM
If you've Visio Professional available that could be done without any coding using the Datalink feature, to link shapedata to a database or an excel sheet.
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: aledlund on April 02, 2014, 11:44:28 AM
Jon,
i'm aware of what a parking lot may look like, the request was for the visio file. Jumpy is correct in that the easiest method is to datalink using one of the Visio Pro versions (starting with 2007).
al
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jon Gottlob on April 02, 2014, 02:18:24 PM
al - I took "without seeing" as something else.  I've attached the diagram, but it looks like I may not need to worry about the code anyway.

Thanks for the suggestions.  I will do some reading up on datalink and see if it meets my needs.  If not, I'll be back.

Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: aledlund on April 02, 2014, 02:49:45 PM
Jon,
The parking spot 'name' is merely a text box, so linking the shape to a datarecordset is very simple. Just ensure that the record has the spot name in it so that you can create the link. (it's a link to text operation)
al
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jon Gottlob on April 02, 2014, 03:03:43 PM
Thanks!

A question.  How does it keep the visio diagram in synch with the data in the table?  Would it refresh it when the document is opened?
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jumpy on April 03, 2014, 07:52:41 AM
Should be all in here:

http://office.microsoft.com/en-ca/visio-help/refresh-imported-data-HA010014271.aspx

Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: JohnGoldsmith on April 03, 2014, 08:47:24 AM
There's also a video on Data Linking here that might help:

Dynamically Link Business Data to Shapes (https://www.youtube.com/watch?v=ZSeLZ0ip_oI)

from the 'MVP Sessions for Getting Started with Visio 2010 (http://blog.bvisual.net/2013/07/08/mvp-sessions-for-getting-started-with-visio-2010/)' series.

Best regards

John
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jon Gottlob on April 03, 2014, 03:59:42 PM
Thanks for all the help.  I will have to watch the YouTube video at home, since we cannot access that at work.

Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: Jon Gottlob on April 07, 2014, 04:40:41 PM
Well, the initial auto-linking is working, but refreshing the data after I've changed values in the database is not.

Any thoughts?
Title: Re: Update an existing parking lot visio document in VB.Net.
Post by: aledlund on April 07, 2014, 05:12:59 PM
doing problem determination is a two step process, a.) verify that the recordset has been updated correctly b.) matching the record/recordset against the shapesheet data.
al