I'm using a central startup routine to initiate several TCP connections, start up a background thread that does some monitoring, and instantiate a group of objects that track information throughout the lifetime of a networking session.
There are periodically server-side problems with the protocol I'm working with, at which point the whole mess has to be torn down and set back up, so at the front end of the startup routine I'm disposing of instantiated tracking objects, killing the monitoring thread, and disconnect/close the existing sockets (if they're already set up). At that point the sockets may be in the middle of an asynchronous send or receive operation, which is causing system exceptions when the socket is torn down and then the asynchronous delegate gets called and EndSend or EndReceive thinks there isn't an object there anymore.
I had assumed .Disconnect and .Close would take care of these async processes, and I'm a little lost. Is there some one-shot method I can use to abort those async operations before I tear the sockets down to re-instantiate them?It never hurts to try. In a worst case scenario, you'll learn from it.
I need some help with to make a messages system. I build a form with display a message code and the message.
Example : 0000001 : Not connected to network
The problem is that i want to store in a central place where the numbers and the message will be stored in the code. I was thinking about a array to store the date.
I am working on a program using VB.Net 2010 which will enable me to setup groups of files & folders for back up with syncing capabilities etc. I have a concept program which is based on some sample code I found out in one of the VB.Net forums. I have modified it from a command line based program to a form based program. At the moment I consider this code to be a "concept" program which once I have the various copy/sync routines developed and debugged will be integrated in to another program I wrote for creating "Back Up" groups to automate the process. There are some 3rd party programs that do similar things that I want to do such as Microsofts Sync Toy, but none of them offer the grouping and exclusions options that I am going to program in to this backup/sync program.
So here is my problem, I have the included code taking two folders, a source and a destination, and copying everything from the source to the destination. It will skip over any unchanged files/folders and will delete anything found in the destination folder that is not found in the source folder and it will update all files in the destination folder that have a newer version in the source folder. In other words it will mirror image the source to the destination but will be smart enough not to copy unchanged items from the source to the destination thereby saving a lot of time. The sync part of the program is working fine, the displaying of the progress and results is not.
is there any way to reference a particular code routine in VB.net external to the current loop/routine?Example:
If Var01 < 5 [Routine A] Else [Routine B] End If
where Routine A and Routine B are code sequences at the end of the entire program -- such as outside of the current sub or class? The idea would be to reference an otherwise repetitive code.
I need to implement a routine to read a plain text file, BUT that file has a predefined format.The file format is as follows:
Quote:
<FILE_PROPERTIES> 'The "< >" also appears Propertie1="String" 'It's possible to have spaces after or before the "=" Propertie2="String" Propertie3="String" PropertieN="String"
[code]....
Is there any Windows API Routine to read something like that?Or could you point me an URL where something is implemented?I don't want a procedure to read the file line by line and comparing them with Line Input because blank spaces, empty lines and comments starting with " // " may appear too, and I don't want to take them into account, but also I need to save changes to the file, but only to the modified section, without having to read the whole file, and re-write it completely.
Binary access can't work, because I don't know what's the size of each "section", since the number of elements into it can change. I need something like the "ReadINI" Windows API Procedure, but allowing me to read the "[XXX]" sections headers, and also the "<XXX>" file title header.
Originally Posted by errorUnable to copy file "objReleaseVBNET.exe" to "binReleaseVBNET.exe". The process cannot access the file 'binReleaseVBNET.exe' because it is being used by another process.I am using Windows 7 and i have this odd problem during debug (F5-Run).It works only when i Run it for the very first time. After that i am keep getting this odd error message. I played with the permissions for a while but still nothing.
I have got the following code to copy a file from one location to another.
Dim strPath As String = txtUploadLocation.Text Dim strFile As String = txtUploadFile.Text Dim FI As New IO.FileInfo(strFile) Dim SR As New IO.FileStream(strFile, IO.FileMode.Open) Dim SW As New IO.FileStream(strPath, IO.FileMode.Create)
[Code]...
Now obiously this is saying a permissions problem however i have checked the permissions and the user i am runing it from definatly has write access (full control as im a system admin., I have also just tried copying it to the local maching instead of the server in a remote location and it gives me the same error.
I have a program that uses IO.File.Copy to copy files from point a to point b. Its slow, which is fine because there rather large files. I was wondering if there is way to get an estimate time to copy a particular file(s).
Example: File a will take 1 hour to copy, File B will take 30 minutes to copy. Estimate Total Time: 1 hour 30 minutes.
Looking for an idea of where the best place to keep files for a program. I use them frequently and they interact with the program directly. I want to place them in a place where they won't be easy to find if someone is just cruising thru the directories. Any ideas?
I have a insanely large file that has a lot of customer data in XML format. The start of a customer and end are how I'll determine the starting and ending points of the customer data I need to extract. The is the number I'll be searching for. I'll input a regular text file with 12-byte document numbers into the file (Doc Number List.txt), search the massive XML file (example.xml) for those document numbers, find the data before and after the DOC_NUM tags, but within the CUSTOMER tags and extract it to a formated file. The formated file needs to have these tags, <?xml version="1.0" encoding="ISO-8859-1"?>
I've been looking at accessing shared folders, read and write, via the network without being prompted by the OS for the username and password.
On this forum, and googling, I can find many things about accessing network shares, but none using code which also passes the username and password required.
What I'm basically looking for is to not have to map a drive on the users computer. Then using code, write or read files from a network share and at the same time pass the username / password required for that network share.
I am using the OleDbDataReader routine to examine and manipulate Access databases.I am trying to find a procedure for indicating when the end of file is reached.I am getting an error message once the end of file is reached and another record is attempted to be read.The.HasRows modifier does not work; that merely determines if the source database contains rows, not if there are any rows remaining.
I am try to filter some data and add to another datatable. While Run time the Error is shows Column *** already belongs to another dataTable Here My code:
I have basic text report (.txt) that is created by a custom application. My client would like it to page break at a certain spot.
Does anyone have a routine that would allow me to insert PCL code into the file so that when printed it page breaks? I'd search for certain text and then insert the codes just prior to the text.
Certainly if someone has a better "mousetrap" then let me know.
Like I imagine everyone, I often have problems navigating my code because the flow can jump from place to place. For example, if my code calls routine1, and I then want to go to routine1's code, I know that I can click in the dropdown menu and it will take me to that sub. But wouldn't it be easier if I could somehow right click on the call to routine way and select something like 'take me there' which would transport me from the function making the call to the code for the function being called? Then it would be easy to hop from place to place.
I have written a text editor for an assignment but I am struggling on where to start on this bit. What I Want To Happen:- When the user saves there work I want the name of the file to be shown next to the name of the program at the top left hand side of the form. I am not sure If I just need to create a simple sub routine for adding the name of the file then calling the method in the save as routine.
I want to write a generic file saving routine where the routine is passed data in the form of a collection and it sets a containsStructure flag. I wanted to be able to save the data from the collection, but if it is a collection of structures I want to be able to extract the data from the structure to write to the file.
The only trouble is, that I cannot do something like: For Each s As dataStructure In data Next Since the compiler complains that dataStructure is not defined. Is there a way to code around this?
I have finally got my code all working, but there is just a quick query really. At the moment I have all the database stuff in each form seperatly. When I place it in a global module, it looks like the dataset is being duplicated I was wondering why this happens when I place it in a global module?
This the code I use and the code I would put in a global module
Dim con As New OleDb.OleDbConnection Dim dbProvider As String Dim dbSource As String
I've got an app which uses a background worker to copy files. It works fine but some files are quite large and it "appears" as though the app isn't doing anything. Is there an alternative to the File.Copy method of copying files so I can report on the progress of individual file copies, like the percentage complete?
Before I begin I would like to mention that I am not a noob in VB, it's just I've never had to do anything this complex before. Basically what I want is to have a program that you can load a txt file in, have it copy key words, and paste it in a textbox so I can use it later on. So in this text file, there is a bunch of info, but I am only needing a certain part. Here is an example of a text file (actually a .dat file, but is easily read):
i am very new to VB. I am working on file operation such as show files, copy file, delete file, show current directory, rename folder, make folder. My problem right now is with delete and copy file. I have a method of delete and copy but i dont know how to pass this method on a button.
I have a function that searches AD for members of various groups. If I remove the loop, I don't get the error "A column named 'cn' already belongs to this datatable", however, I need to iterate through each OU.
Function getCOMDLNames(ByVal searchStr As String) As DataTable Dim MySearchRoot As DirectoryEntry = New DirectoryEntry("path", "usr", "pwd") Dim MyDirectorySearcher As New DirectorySearcher(MySearchRoot)
I have a program that I copy a file from one server to another. This has been working well if the servers are on the same domain.I now need to copy a file to a server on a different domain. If I were to do this manually it would prompt me for my username and password.
I don't see any way to put a username and password with doing an IO.File.Copy. Is there a better way to do this?IO.File.Copy(strSource, strDest)
I have a View in which I have a code block where I am setting some variables and later on using those variables to show or hide some areas.When I build this website. A compilation error comes up on the line @( stating Syntax Error and another one stating Expression Expected. Can anyone guide me what I am doing wrong here...
I am developing an Application in VB.Net 2.0. I have a module which would copy files from the Local Machine to a shared folder on remote machine. This shared folder on the remote machine is an authenticated folder. So, after searching on the Internet I found the following piece of code.[code]Another point to note is that when I connect to the File Share using Windows Explorer and then try to execute the application, it works properly.I am not sure why I am getting the error when I do not connect to the Shared Folder using Windows Explorer.Do I have to set some property so that the Credentials passed in the authentication are used.I also checked some posts that suggested setting up Mapped Drive to the Shared Folder on the Local machine and then to copy the file using IO.File.Copy function. However, I cannot use this as this Remote Folder should be only accessed through the application and not in any other case by the User. The users will not even have the credentials to this remote Server as it will be configured by the admin.So, Is there any way in which I can set this up and transfer the files from local machine to a remote shared folder?