hi,
i have an open & delete btn. onclick of open as visio drawing opens in visio
& onclick of delete the drawing gets deleted from the filesystem. The problem
is i am unable to perform these actions if the file is already opened in
another instance of visio. how do i check if it's already opened and then
throw an error msg?
thanks 4 3011
Use Try/Catch.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.
"jes" <je*@discussion s.microsoft.com > wrote in message
news:9F******** *************** ***********@mic rosoft.com... hi,
i have an open & delete btn. onclick of open as visio drawing opens in visio & onclick of delete the drawing gets deleted from the filesystem. The problem is i am unable to perform these actions if the file is already opened in another instance of visio. how do i check if it's already opened and then throw an error msg?
thanks
Hi,
I am not using the filestream to open the file, i am using visio's object to
open the file. Do u think the try/catch would be the only resolution to check
if the file is already opened?
If File.Exists(fil ename) Then
visioApp = CreateObject("v isio.applicatio n")
visioDocs = visioApp.Docume nts
visioDoc = visioDocs.OpenE x(filename, 32)
end if
thanks
"Kevin Spencer" wrote: Use Try/Catch.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer You can lead a fish to a bicycle, but you can't make it stink.
"jes" <je*@discussion s.microsoft.com > wrote in message news:9F******** *************** ***********@mic rosoft.com... hi,
i have an open & delete btn. onclick of open as visio drawing opens in visio & onclick of delete the drawing gets deleted from the filesystem. The problem is i am unable to perform these actions if the file is already opened in another instance of visio. how do i check if it's already opened and then throw an error msg?
thanks
Hi jes,
There are other ways to see if the file is already opened, but none of them
are pretty. This is one case where catching an exception is a good idea.
You can read more about the way to do this here: http://msdn.microsoft.com/library/de...Exceptions.asp http://msdn.microsoft.com/library/de...exceptions.asp
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.
"jes" <je*@discussion s.microsoft.com > wrote in message
news:F0******** *************** ***********@mic rosoft.com... Hi,
I am not using the filestream to open the file, i am using visio's object to open the file. Do u think the try/catch would be the only resolution to check if the file is already opened?
If File.Exists(fil ename) Then visioApp = CreateObject("v isio.applicatio n") visioDocs = visioApp.Docume nts visioDoc = visioDocs.OpenE x(filename, 32) end if
thanks
"Kevin Spencer" wrote:
Use Try/Catch.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer You can lead a fish to a bicycle, but you can't make it stink.
"jes" <je*@discussion s.microsoft.com > wrote in message news:9F******** *************** ***********@mic rosoft.com... > hi, > > i have an open & delete btn. onclick of open as visio drawing opens in > visio > & onclick of delete the drawing gets deleted from the filesystem. The > problem > is i am unable to perform these actions if the file is already opened > in > another instance of visio. how do i check if it's already opened and > then > throw an error msg? > > thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dino |
last post by:
dear all,
i've created an application for a customer where the customer can upload
..csv-files into a specified ftp-directory. on the server, a php-script,
triggered by a cronjob, reads all the data, imports it into a mySQL database
and deletes the .csv-file after the import.
so far, so good.
but in some cases the cronjobs starts running when the file is not completely
|
by: Wolfgang Kaml |
last post by:
Hello All,
I have been working on this for almost a week now and I haven't anything up
my sleeves anymore that I could test in addition or change....
Since I am not sure, if this is a Windows 2003 Server or ADO or ODBC issue,
I am posting this on all of the three newsgroups.
That's the setup:
Windows 2003 Server with IIS and ASP.NET actiavted
Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
|
by: wetherbean |
last post by:
Hi group..I am writing a playlist management protocol where I have a
file that holds all the playlists and a file that holds all the
songs....before a playlist is created I need to check to see if the
playlist file is empty so that I can assign an integer value to a
playlist id field if it is the first playlist being written to the
file....can anyone help?? Thanks in advance
wetherbean
|
by: Dino Buljubasic |
last post by:
My application creates some temporary files that are deleted when my
application terminates.
However, if a temp file is open, it will not be deleted and
application will crash.
How can I check if a file is open before deleting it
Something like this
|
by: Dino Buljubasic |
last post by:
If I want to delete a file I can call File.Delete(filePath)
but what happens if I am trying to delete the file that is open???
In java you would do someting like
int status = fileExists(filePath) // return 0, 1, or 2
2 means file exists and it si open
but VB returns boolean value telling file exist or not
| |
by: cmay |
last post by:
The only examples I have seen on how to check if a file is locked is to
try to open it a catch an exception.
MS has stated that you should never use error trapping in this manner.
Is there no other way to identify if a file is locked w/o trapping an
exception?
|
by: Ros |
last post by:
There are 10 files in the folder. I wish to process all the files one
by one. But if the files are open or some processing is going on them
then I do not want to disturb that process. In that case I would
ignore processing that particular file and move to next file.
How can I check whether the file is open or not?
I tried os.stat and os.access but I am not getting the expected
results.
Also I checked in IO exceptions, IO error handler...
|
by: giftson.john |
last post by:
Hi,
I am creating an application which migrates all documents from one
repository to another repository. Before migration i have to verify
all the documents are unique. No duplicates has to be uploaded. Event
the document created date, modified date, filename can be different.
How to find the document is duplidate.
What i did is, i created a file and did save as and saved into another
location. I am not able to find that the document...
|
by: Kimmo Laine |
last post by:
Hi!
Is there a way to check if file is already open/used by another process?
I know that i can do something like this to check it
try {
StreamWriter sw = new StreamWriter(filename);
sw.Close();
} catch (IOException) {
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |