473,378 Members | 1,410 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,378 software developers and data experts.

How to handle user input file name

Hi all,
I'm new to VB, using VB.Net express edition. I'm collecting data from a data acquisition card and writing the data to a .txt file. I have an input box for the user to input a file name. If the file already exists I want to warn the user and ask if they want to over write the file. I'm using MsgBox style YesNo. If they say yes, no problem. But if they say no, what do I do? I did a bit of searching but couldn't find a recommended way of handling this. I think I am digging a deeper hole....Any suggestions?
Thanks,

Code is below:

Dim LSVDAQ As String

'Read file name
LSVDAQ = FileNameBox.Text

'check here that filename box is not null
If LSVDAQ = "" Then
MsgBox("You must enter a filename")
End

ElseIf My.Computer.FileSystem.FileExists(LSVDAQ) Then
MsgBox("!!! File already exists, overwrite?", MsgBoxStyle.YesNo)
If MsgBoxResult.No Then
LSVDAQ = InputBox("Enter new filename", "", LSVDAQ, , )
MsgBox(LSVDAQ)

ElseIf MsgBoxResult.Yes Then
'no operation
End If

Else
MsgBox("File " & LSVDAQ & " will be created")
End If
Oct 30 '07 #1
0 860

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: johnny | last post by:
hi all, I have an old script which has a dynamically populated form where the user chooses the items from as many list/menu as the categories existing in the database and then on a confirm page...
3
by: Nancy | last post by:
Hi, Guys, I am new to Python. I am trying to following the example on http://www.modpython.org/live/current/doc-html/tut-pub.html In this example, it gives the following html code, <form...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
39
by: tydbowl | last post by:
I have a problem where the below code chunk causes handle leaks on some machines. The leak APPEARS to be handles to the registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet...
2
by: Gary Wessle | last post by:
Hi I need help organizing this program in the right way. I included the code below which compiles and runs and gives the desired effect to a certain point, but I don't know what the next step...
5
by: Lin | last post by:
Hello, I am new to c#, please help. I am writing an application, which will be able to send email automatically, for a very large organisation. The application I am writing should be on the...
2
by: Martin M. Pedersen | last post by:
Hi, I have a program where I read a lot of user data. How can I handle the case where the user press control-d ? Is it possible to disable control-d or re-open the cin ? I have made a small...
5
eragon
by: eragon | last post by:
I wrote this function to create a new file when the user posts in my forums, and its not creating a new file, can you help me? this script is not copyrighted as the last one. function...
1
by: webmasterATflymagnetic.com | last post by:
If you use Javascript you can set the FORM ACTION to call a function within the same file (or at least within a *.js file that was previously loaded into that file). Can you do something similar...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.