Deleting Files With Dynamic Names?
Mar 11, 2012
Each time it runs, a program of mine creates an Excel document and names it using the current date ("Alerts from 29062011.xlsx" for example). The program gets run once a day,every day.The users have requested that I have the program delete the previous days Excel file each time it runs so that they don't take up space. I'm unsure how to do this though since, for example, if it is run on the first day of the month it would have to know
View 6 Replies
ADVERTISEMENT
Aug 4, 2011
I have to delete all the textboxes after I clicked the Save button, I have a delete code here that deletes the textboxes one by one. I'm just starting in vb.net.
Public Class FunctionProcessor
Dim TextBoxes1 As List(Of DateTimePicker) = New List(Of DateTimePicker)
Dim TextBoxes2 As List(Of TextBox) = New List(Of TextBox)
[Code].....
View 2 Replies
Mar 19, 2009
I am developing a .Net application that populates a checklist by querying the directories inside a "base" directory (this part already accomplished). The purpose is to show these directories and allow the user to "check off" the directories they want to delete, and then click a button to delete just those directories (this is the part I'm stuck at).My checklist populates, but how would I go about deleting just the directories that get checked?There is one more thing. Each of these directories might have a log file (of the same name) inside the "base" directory; this corresponding log file should also be removed.
View 2 Replies
Sep 21, 2010
im trying to create smarter more efficient code in my project by having all lables change to their desired states by use of a for loop. currently my labels are all something like lblB1. can i do anthing like the following?
[Code]...
View 9 Replies
Jun 29, 2009
I have the following code to create an array of serial ports.
[Code]...
View 5 Replies
Jun 8, 2012
My question is how best to avoid SQL Injection with the method I am currently using.EDIT (Reasoning): There are many of columns in a number of tables (a number which grows (only) and is maintained elsewhere). I need a method of allowing the user to decide which (predefined) column they want to query (and if necessary apply string functions to). The query itself is far too complex for the user to write themselves, nor do they have access to the db. There are 1000's of users with varying requirements and I need to remain as flexible as possible - I shouldn't have to revisit the code unless the main query needs to change - Also, there is no way of knowing what conditions the user will need to use
View 2 Replies
Dec 7, 2010
I'm looking to create multiple variables based on a counter object. For example if a counter object is 6 I want to create 6 instances of the variable mText
Something like:
Dim i as integer
Dim Count as integer = 6
[code].....
View 1 Replies
Jan 29, 2009
I need to iterate through controls using dynamic construction of control names and it looks like this could be what I need, however I never used this before and it does not quite work. What am I doing wrong? GroupBox1 is what I am attempting
Dim x as Integer = 1 For Each ctrl As Control In CallByName(Me, "GroupBox" & CStr(x), CallType.Method).Controls The runtime error is "GroupBox1" not found on Form1 even though I can select Me.GroupBox1 from the dropdown list.
View 14 Replies
Mar 9, 2012
I have multiple file upload boxes on a form in my mvc3 application. Request.Files shows 3 files when I put a break point in the below function and look at it.. Problem is other than coding a counter and using a select case I dont see a way to handle saving each file name to the database column it belongs to... Is there away to assign the variable on the fly I guess you could say So that the foreach loop would drop the file in the correct column. Ie handoutFile1, handoutFile2 , handoutFile3, Etc. As it stands the below will overwrite the filename in handoutfile1 every time the loop is gone through. I thought about throwing a counter in the loop and just put a select case on it to assign the db column based on the counter number. Seems like a cheap work around though. [Code]
View 2 Replies
Feb 8, 2011
Is there a way to use Meta Tales or Table names to Construct a dynamic query in LINQ?
foreach (var metaTable in db.Mapping.GetTables())
{
var queryType = metaTable.RowType.Type;
[code]....
Is there a way to do something like this? The attempt above yields the error:Could not find an implementation of the query pattern for source type 'System.Data.Linq.ITable'. 'Select' not found. Consider explicitly specifying the type of the range variable 'q'.
View 2 Replies
Feb 12, 2011
I have seen questions like What is the best way to empty a directory?
But i need to know,
what is the fastest way of deleting all the files found within the directory, except any .zip files found.
Smells like linq here... or what?
UPDATE: By saying fastest way, i mean the Fastest execution time.
View 3 Replies
Jul 3, 2010
vb 2008 on Vista: I have a folder called "Documents", and another called "PastDocuments". When the user deletes a client, I copy the contents of Documents into the Past Documents folder. Next, I need to delete the Documents folder, but there are existing files within that folder, so it won't let me delete it. What is the easiest way to delete ALL files within that folder?
View 1 Replies
Nov 26, 2009
I have some code that launches a .bat file. The error comes from within the .bat file, navigating to the specified directory."F/Program Files/ Tversity/Media Server/data/ if i run cmd, then manually navigate to F/program files, i cannot navigate into any other directory within program files. Wierd..if there is an easier option to just use vb.net without launching a .bat that might help please let me know. i know i am not showing any vb.net code, but it just launches a .bat file. i know the forum rules, but i am hoping that someone might know why i can't navigate to my program files. it is not permissions, i am an admin on the local machine no domain.
View 1 Replies
Mar 11, 2010
So I have a program that allows the user to load up some images, which appear in a ListBox. You can click the imported images and they load into a PictureBox. [code]The path is not of a legal form.You can load up the code and see for yourself. Now I need to be able to delete these images from the ListBox. The exception occurs because the image is now null, and can't load.
View 6 Replies
Mar 13, 2012
Just wondering how to delete a selected record from a .dat file
I am new to programming so go easy
View 2 Replies
Jun 27, 2011
I'm working on this program to delete .tmp files that are older then 5 days. The only problem that im running into is if there are no files older than 5 days to display a messagebox "There are no .tmp files older than 5 days".
View 4 Replies
Jul 10, 2009
I have a problem with a progress bar, i want to delete a folder with this sub:
Dim di As New System.IO.DirectoryInfo(path)
di.Delete(True)
I would like to see a progress bar. I saw some examples with copy but doesn't work with this sub.
View 5 Replies
Jun 4, 2009
I'm experiencing a wierd problem deleting some .csv files. Any .csv files named 1.csv, 2.csv, or 3.csv will not delete using delete() method of system.io namespace. if i do any number greater than 3 it works. For example, 4.csv, 5.csv, etc. works fine. 1.xls, 2.xls also is ok. The error it is throwing in my log is 'access to the file is denied.' Nothing is using the file. I even copied a new file into the directory and it does not work. I even created a 1.csv in a totally different directory with no luck. What is going on with this? Has anyone ever experienced this?
View 9 Replies
Jan 19, 2010
I have been working on software that finds a specific backup file type and lists it in a list box. Then the user selects the files he/she wants to delete. Then clicks the delete button to remove the files.I have everything finished and working excpet for deleting the actual file. I figured out the code to delete the actual list item... but I cannot figure out how to get the selected file to be deleted within its directory as well... been at it for 4 hours now.
View 4 Replies
Aug 27, 2009
I have a serious problem,so i tought i can ask here.I'm only a BEGINER!So,i looked on youtube,to make an anti-virus in Visual Basic(i then heard about VB2008:D).I maked a scan button,and putted some strings that will scan some computer's folders and show de detected viruses on a letterbox.Now,i wonder if someone nows a way(code or not) to add a button that will delete all the files detected that are shown on that letterbox.I want not to delet them manualy,i want my small anti-virus to that that.IS THERE A WAY?
View 14 Replies
Feb 14, 2010
I have VB 2008. How can I delete ALL files in a directory with the extension ".gif" ?
View 2 Replies
Nov 30, 2010
My naming convention for certain files is ------------kill 28 nov 2010.ext Is there a way I can throw an if statement and a few variables together to check each file in a folder and if date.today = variable then delete file? I want to make a program i can schedule to run daily w/task scheduler, I haven't used VB in awhile but just found the disks from school so i figured this was the easiest way to go about it.
View 9 Replies
Oct 9, 2009
I am trying to delete multiple files in a certain directory. I need to delete *.o, *.r, *.w, *.rs, *.op, *.os. My coding does not seem to be working.
My.Computer.FileSystem.CurrentDirectory = "c:RELAP5MOD4Demo"
View 1 Replies
Sep 21, 2009
I am concatinating a couple of text files and then deleting the individual files. (Not the output file)
The only problem is that I am getting a permission error "Exception from HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)" when I try to delete the files.
I can delete the files using the code below if I do not concatinate the files but as soon as I do I cannot delete them.
To concatinate:
Public Sub MeltText()
Dim SW As New IO.StreamWriter(OutPutFile)
Dim Files As String() = IO.Directory.GetFiles(StartDirectory, "*.txt")
Dim File As String
SW.WriteLine("Sw
View 2 Replies
Jun 29, 2009
how to even start a code project of this sort but here it goes... I have an external Hard Drive with some music. My itunes makes duplicates of all my songs so this is what i have.
Dance.mp3
Dance 1.mp3
Dance 2.mp3
Dance 3.mp3
Party.mp3
Party 1.mp3
[Code]...
What I want to do is have the program search the files and delete all files that have a duplicate with a number behind it... Now I would use windows search but some of the songs are like 1001.mp3 or 1001 1.mp3... I want it to look like this when i get done (from the above):
[Code]...
View 1 Replies
Apr 1, 2009
I have created a project where I can attach files and I am displaying the name of the file, example:
Mytestfile.doc
mytestfile.txt
Mytestfile.pdf
I have the names being displayed on a listbox, so far everything is working just the way I expected to work.When a file is selected from my opendialogbox, the file gets saved into a folder under my local disk, so far so good.The problem that I am having is deleting the file from the folder.I have added a delete button and I would like to when I click or highlight one of the file names to go into where the file was saved previously and deleted This is the code that I have for the delete funtion:
[CODE Dim sFileName As String = "C:program filesSupport DeskAttachments" & ListBox1.Text
System.IO.File.Delete(sFileName)][/code]
The problem is that if I add the code to the clcik event under the listbox, it works great, but if I add the code to the click event under my delete button, it doesn't work, what I found is that under the path, if I am under the click event from the listbox when it gets to the lisxtbox.text it displays the file name, which is what I whant, but when i tried the code under the click event under my delete button the listbox.text is blank.
View 3 Replies
Jul 6, 2010
I have a series of large files (4GB) that when I delete takes a very long time. This only occurs on a USB drive that I have attached to my PC. If I do the same thing on the internal drive the files delete quickly. It is as if the files are being overwritten before being deleted. I am looking for some guidance or other approaches.
View 5 Replies
Aug 10, 2009
How can i delete image files (ex *.gif) that might be in use, by another process in a directory?
View 3 Replies
Jan 27, 2011
Need code for the following
The VB script will have 3 parameters
1.zip filename
2.extraction filename
3.rejection file name
We need to do the following
1)It should first zip the extraction file and rejection file into zipfile name as in argument 1
2)Check the file zippping is completed
3) deleted the original files(extraction file and rejection file)
[code]...
View 1 Replies
Nov 29, 2011
Why are my new (moved to) text files deleting after the move?
If TextBox1.Text = "* DISPLAY SCROLL 10 *" Then
Dim D10A As StreamReader = File.OpenText("LINE 3 UNITS.txt")
D10A.Close()
[code]....
the file "line 3 units.txt" contains 3 choices. what I need to do is write one of these selections to the new file "line 3 units new.txt" then recognize the contents of this file to control a boolean statement.
Dim W As String = (D10B)
If W.ToLower.Contains("load") Then
LIN3LD = True
[code]....
I end up with 2 known problems.
1) The new text files delete
2) if the file doesn't delete (for whatever reason) the CONTAIN statement doesn't recognize either "load" or "speed"
View 2 Replies