1-20 of 91
Previous
Next |
CSV2DataTable - Importing the data contained in a CSV file into a new DataTable
by Marco Bellinaso
Import the data contained in a CSV file into a new DataTable. By default the values are Tab delimited, but you can use the second overload version to use any other string you want.
Example:
Dim table As DataTable = CSV2DataTable("D:\Users.txt")
DataGrid1.DataSource = table
|
DataTable2CSV - Saving a DataTable to a CSV file
by Marco Bellinaso
Save the input DataTable to a CSV file. By default the values are Tab delimited, but you can use the second overload version to use any other string you want.
Example:
Dim ds As New DataSet
SqlDataAdapter1.Fill(ds, "Users")
DataTable2CSV(ds.Tables("Users"), "D:\Users.txt")
|
FindFiles - Finding all files with a given filespec
by Francesco Balena
Finding all files with a given filespec into an ArrayList. Optionally scan also subdirectories of the input dir
Example:
Dim files As New ArrayList
FindFiles(files, "D:\Articles", "*.doc", True)
For Each file As String In files
Debug.WriteLine(file)
Next
|
FileToArray - Reading all lines from a text file into a String array
by Marco Bellinaso
Read all lines from a text file into a String array
Example:
Dim lines As String() = FileToArray("D:\test.txt")
Dim line As String
For Each line In lines
Debug.WriteLine(line)
Next
|
JoinBinaryFiles - Joining a variable number of binary files into a single file
by Marco Bellinaso
Join a variable number of binary files into a single file
Params:
- resultFile: the complete path of the result file you want to create
- sourceFiles: the sequence of files whose content will be joined together
Example:
JoinBinaryFiles("D:\Test.bin", "D:\Source1.bin", "D:\Source2.bin", ...
|
CountFileCharacters - Counting how many characters of a given type are in a file
by Marco Bellinaso
Count how many characters of a given type are in a file
Example:
Dim charCount(255) As Integer
CountFileCharacters("c:\test.txt", charCount)
Debug.WriteLine("the char 'A' was found " & charCount(Asc("A")) & " times")
Debug.WriteLine("the char 'a' was found " & charCount(Asc("a")) & " ...
|
GetDriveLabel - Retrieving the label of the specified drive
by Marco Bellinaso
Retrieve the drive name (label) of the specified drive
Note: requires a reference to the System.Management assembly
Example: MessageBox.Show(GetDriveLabel("D"c))
|
GetDriveSerialNumber - Retrieving the serial number of the specified drive
by Marco Bellinaso
Retrieve the serial number of the specified drive
Note: requires a reference to the System.Management assembly
Example: MessageBox.Show(GetDriveSerialNumber("D"c))
|
GetUrlFromLinkFile - Retrieve the Url pointed by a link (*.url) file
by Marco Bellinaso
Get the Url pointed by the input link (*.url) file
Example: print the Url of all the link files in the Favorites folder
Dim filePath As String
For Each filePath In System.IO.Directory.GetFiles( _
Environment.GetFolderPath(Environment.SpecialFolder.Favorites), "*.url")
Debug.WriteLine(System.IO.
|
SetFileLength - Set the length in bytes of the input file
by Marco Bellinaso
Set the length in bytes of the input file
Example:
Dim filePath As String = "c:\test.txt"
MessageBox.Show("Original length: " & New System.IO.FileInfo(filePath).Length)
SetFileLength(filePath, 50000)
MessageBox.Show("New length: " & New System.IO.FileInfo(filePath).Length)
|
GetResourceContent - Retrieving the content of an embedded text file
by Marco Bellinaso
Retrieve the content of an embedded text file
Note: the file must be included in the project as an embedded resource.
- after adding the file to the project set its Build Action property to Embedded Resource
Example: txtScript.Text = GetResourceContent("script.sql")
|
IsDriveReady - Returns whether a drive is ready
by Marco Bellinaso
Returns a boolean indicating whether a given drive is ready
Example: check if the floppy disk drive is ready
Debug.WriteLine(IsDriveReady("a"))
|
IsExecutableFile - Returns whether the file is an executable
by Marco Bellinaso
Returns a boolean indicating whether the file is an executable
|
IsImageFile - Returns whether the file is an image
by Marco Bellinaso
Returns a boolean indicating whether the file is an image
|
SearchFileInDirTree - Searches a file on a directory tree
by Marco Bellinaso
Returns the complete path+name of the filename or a null string if the
filename hasn't been found. Only the first occurrence of the file is returned.
Example: Debug.WriteLine(SearchFileInDirTree("d:\codearchitects\codebox", "codebox.exe"))
|
SearchFileOnPath - Searching a file on the system
by Marco Bellinaso
Searches a file on the system
Returns the complete file path+name, or "" if file not found
If searchDirs is omitted, then the file is searched
in the following directories, in this order
1. the directory from where the app loaded
2. the current directory
3. the \Windows\System32 directory ...
|
CompareFiles - Comparing two binary/text files
by Marco Bellinaso
Returns a boolean indicating whether two files are equal
Example: Debug.WriteLine(CompareFiles("D:\File1.mdb", "D:\File2.mdb"))
|
ConcatenateFiles - Concatenating multiple text files
by Marco Bellinaso
Concatenate a variable number of text files into a single result file
Params:
- resultFile: the complete path of the result file you want to create
- header: a string that is written when a file is added to the result file.
Note: this string can contain the #FilePath# tag that will be ...
|
FolderHasFiles - Returns whether the specified folder has files
by Marco Bellinaso
Returns a boolean indicating whether the specified folder has files
|
FolderHasSubFolders - Returns whether the specified folder has sub-folders
by Marco Bellinaso
Returns a boolean indicating whether the specified folder has sub-folders
|
1-20 of 91
Previous
Next |