473,382 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

If File Exists then ......

He Group,

I would like to be able to Modify the follwoing code:

Private Sub btnCentrexLinesReports_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCentrexLinesReports.Click
rptForm.Text = "Excellence.Net - Centrex Lines Cab Report"
rptForm.CRVReportPrint.ReportSource = New CentrexLinesCabReport()
rptForm.CRVReportPrint.RefreshReport()
rptForm.ShowDialog()
End Sub

So that, If \\Data01\Ambercat Database\Excellence.Net\Network.txt exists it
runs and if it dosn`t exist it pops up a Message box saying Sorry You are
working offline, and reports carn`t be run.

Anybody suggest the best way to do this?

Cheers
MCN
Nov 21 '05 #1
2 1370
Try this:
Dim FILE_NAME As String = "C:\LogFile.txt"
If Not File.Exists(FILE_NAME) Then
Exit Sub
Else

B

"MadCrazyNewbie" wrote:
He Group,

I would like to be able to Modify the follwoing code:

Private Sub btnCentrexLinesReports_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCentrexLinesReports.Click
rptForm.Text = "Excellence.Net - Centrex Lines Cab Report"
rptForm.CRVReportPrint.ReportSource = New CentrexLinesCabReport()
rptForm.CRVReportPrint.RefreshReport()
rptForm.ShowDialog()
End Sub

So that, If \\Data01\Ambercat Database\Excellence.Net\Network.txt exists it
runs and if it dosn`t exist it pops up a Message box saying Sorry You are
working offline, and reports carn`t be run.

Anybody suggest the best way to do this?

Cheers
MCN

Nov 21 '05 #2
Cheers Brian,

That worked a treat

Cheers
MCN

"BrianDH" <Br*****@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
Try this:
Dim FILE_NAME As String = "C:\LogFile.txt"
If Not File.Exists(FILE_NAME) Then
Exit Sub
Else

B

"MadCrazyNewbie" wrote:
He Group,

I would like to be able to Modify the follwoing code:

Private Sub btnCentrexLinesReports_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCentrexLinesReports.Click
rptForm.Text = "Excellence.Net - Centrex Lines Cab Report"
rptForm.CRVReportPrint.ReportSource = New CentrexLinesCabReport()
rptForm.CRVReportPrint.RefreshReport()
rptForm.ShowDialog()
End Sub

So that, If \\Data01\Ambercat Database\Excellence.Net\Network.txt exists it runs and if it dosn`t exist it pops up a Message box saying Sorry You are working offline, and reports carn`t be run.

Anybody suggest the best way to do this?

Cheers
MCN

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Geiregat Jonas | last post by:
is using if(open("file",O_EXCL) != -1){ printf("File does exists")}else{printf("file does not exists"); } a good way of checking if a file exists or not, if not how should I do it ?
3
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
18
by: Dan | last post by:
I have code like the following to test for existence of a file. I know the file is there, but File.Exists returns FALSE. The problem appears to be that the file is in a directory beneath "My...
2
by: Zeno Lee | last post by:
I'm using File.Exists to test a file on my C: drive. My program was strongly named and had caspol -af run on it to allow it to run from the network. There are 3 ways I am doing this: 1) Run...
2
by: Chris Fink | last post by:
I am using the System.IO.File class to determine if a file exists on a network share. The File.Exists method keeps returning false, even though the file does exist. The MSDN documentation...
4
by: DEWright_CA | last post by:
I am trying to see if a file exists in a virtual directory, and if so run a method. I try doing File.Exists and the method runs but the file isn't there. Is there a web version of File.Exists or...
52
by: paytam | last post by:
Hi all Can anyone tell me how can I check that a file exist or no.I mean when you use this commands FILE *fp; if(!fp) //Could not open the file doen't show why it can not open it,may be the...
17
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
12
by: snow | last post by:
Hi All, I noticed if file path has a white space, for example "C:\my document \test.txt", the function File.Exists(filePath) always return false in release mode. How could I make this function...
7
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.