Modifying String Containing Invalid NTFS Filename

May 6, 2009

I have a piece of code to debug. Because of unknown bugs it creates a dummy filename. I want to track all the pieces of code who fires that creates the dummy filename, so I can change the dummy file creation to a thrown exception. Since I the dummy filename is stored on a string, I plan to modify that string to contain an invalid NTFS filename, maybe containing invalid chars. Is there a reason to prefer some invalid chars over others? There are some predefined invalid NTFS filename destined to this purpose? (I may think of AUX , COM1 , LPT1 or PRN , but those names run the risk of start sending data to a port instead of throwing an exception).

View 1 Replies


ADVERTISEMENT

Invalid Connection String When Modifying Tableadapter Connection?

Jan 19, 2011

I'm developing an app in vb.net (visual studio 2008). I have a Teradata back-end that will be supporting multiple users in a production environment. I need to use variables in the connection string as the user/pass will be changed every 3 months.

For the gist of the application:

In it's most basic form - I have a search form which works correctly - it pulls results into a listbox and the user then double clicks the list box which will then open a form that is bound via table adapter to the back-end table (Teradata). My connection string is fine everywhere in the application. My problem is using a modified connection string for the "fill" function of the table adapter once the form is opened.

I'm using the code below for the on-load event and keep getting an "invalid connection string" - again, the connection string works fine everywhere else in the app, and the variables etc... are working correctly.

Private Sub adaptertest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DBConnStr As String = "Provider=TDOLEDB;Data Source=TDDEV;Persist Security

[Code].....

View 5 Replies

VS 2008 Scan A Long String And Return Any Values That Occur Between The Tags <FileName> And </FileName>?

Jul 1, 2009

Quick query...I'm trying to scan a long string and return any values that occur between the tags <FileName> and </FileName> I've got a bit of code here to use regular expressions to return the position of the occurunces of both substrings..Just wanted to find out if there is any way to scan for both substrings within one loop (as im currently doing 2, one for the first substring and one for the 2nd) so I can use something along these lines:

ringlist = Mid(XMLRESP, (startloc + 1), (endloc - 1))
MsgBox(ringlist)

to msg box the value between the substrings...either that or another approach to return the value between the 2 substrings (it can be of variable length)

Dim patternstart As String = "<FileName>"
Dim patternend As String = "</FileName>"
Dim matchesstart As MatchCollection = Regex.Matches(XMLRESP, patternstart)

[code].....

View 3 Replies

VS 2008 - Balloon Tooltip Show Invalid Filename Characters

Apr 11, 2009

I am using a Balloon tooltip to show the user which characters are invalid as a filename. I use the IO.Path.GetInvalidFileNameChars array and convert each character to a string, before appending it to a "Invalid filename characters:" string.
vb.net

If IO.Path.GetInvalidFileNameChars.Contains(e.KeyChar) Then
e.Handled = True
Dim str As String = "The following characters are invalid filename characters:" & nl
Dim invalidChars As New List(Of String)
For Each c As Char In IO.Path.GetInvalidFileNameChars
[Code] .....

The result is not pretty: How do I get rid of the 'non-visual' characters (they are probably newlines, backspaces, null chars, etc) so they don't clutter up the list?

View 5 Replies

Modifying Program Means Modifying One Aspects

Mar 16, 2011

Locality Not repeating code..Modifying program means modifying one aspects.

View 11 Replies

Getting Filename From A String?

Dec 8, 2009

I am getting a filename in a String and need to get the name from this. An example:

Dim file As String = "Hello.png"
'I need to get "Hello". One way of doing it is:
Dim name As String = file.Split(ChrW(46)).First()

The problem with this method is; What happens if the filename contains a .?

[Code]....

View 1 Replies

String To String Invalid Cast Exception?

Nov 28, 2009

I have the following code and I'm getting tons of Invalid cast Execptions This is for VB 2008 Case Study Auto Center ( Car Wash)

Imports System Imports System.Drawing Public Class frmMain

[Code]...

View 4 Replies

Date String Format For Filename?

Apr 1, 2009

I am trying to make a filename something like this:

dim Test as string = "name_" + now.toshortdatestring() + ".pdf"

The datestring is like MM/DD/YYYY, which is a particularly bad filename (who want slashes in their file names??)Is there a way to format the date string differently (ie MM-DD-YYYY)?What I was trying to do is tag the file with a date so I could tell when the last time that file was generated, and also keep multiple copies around for archive purposes. Maybe there is a better way and then I dont even need this differently formatted string?

View 4 Replies

Remove The Filename And Extract Just The Path Of The OpenFileDialog.Filename Property?

Oct 17, 2010

How would I do that? Sample code is below that demonstrated that the file I opened contained the full path and file name.

I want to extract just the path and serialize that to the user.config file as a UserSetting value. Then next time the user opens the dialog box, it uses that saved path string to go immediately to the location previously used.

If openFileDialog1.ShowDialog() = DialogResult.OK Then
Properties.Settings.Default.persistConnectionType = openFileDialog1.FileName
Properties.Settings.Default.Save();

[Code].....

View 3 Replies

Check When Filename Contains A Portion Of A String In Program?

Jun 27, 2012

I have a userform in 2008 vb express edition. A part number is created from user input via a concat string. I want to then check if a certain portion of the part number exists in the existing file names in a directory. Below is a more detailed explanation.[code]...

View 2 Replies

Public Sub SaveExcelFile(ByVal FileName As String)?

Nov 22, 2011

Public Sub saveExcelFile(ByVal FileName As String)Dim Excel As Object

[Code]...

that is my code. everytime i open the saved file, it says that it has a different file type and asks me if i want to continue opening it and i click yes. the data inside the excel file is only the word "Success"

View 14 Replies

FileName As String - Application Installed Randomly Locks Up

Dec 23, 2010

I have a quite simple application that is having some random locks up. It's just a few text fields that the user fill it up, 3 sets of Radio buttons, one of them with flags to chose the language and click the PDF button. The application uses iTextsharp to load a PDf template, insert the text into it, depending on the language loads some extra text from a .xml file, and depending on the radio button removes the images from the PDF, closes the pdfstamper and uses [Code] to open the file with whatever PDF application the user have installed and closes itself.

Sounds simple, but after the application is installed in the machine (never in debugging mode) it randomly locks up the application. I tried re-publish the application commenting out the Start(filename) line and the thing stopped locking. And I double checked it, re-publish with the line again and it locked after just a few attempts. [Code]

View 1 Replies

Get The FileName For The Proces.Start(FileName) Method?

May 27, 2009

I have a Listview on my form with different files. I can selet a file en open it with the proces start method. To open the file i use the OpenFileDialog method and select the filename. This work very good. With the code below.

My question is if there is a method to get the selected file without using the OpenFileDialog Box. So when i dubbelclick the selected file the proces will start with open the selected file. Something like:

proc.StartInfo.FileName = Me.SelectedCell.FileName
instead of proc.StartInfo.FileName = Me.OpenFileDialog1.FileName

PS) May be i can preduce the Filename using the OpenFileDialog method on the background.

Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick
If Me.OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

[Code]....

View 8 Replies

Transform An Address Like File:///d:filename.ext In A D:filename.ext

Jun 26, 2009

how do you transform an address like "file:///d:filename.ext" in "d:filename.ext"

without dirty string manipulation??

View 4 Replies

Invalid Character In A Base-64 String?

Dec 15, 2009

Ok, so I got everything working except for one thing. My program stores text in a settings files (which it saves to and encrypts to wonderfully), but it will only work once. For example, I type in an author, title and body, and click Publish, it publishes and is labeled with a "1.". Restarting the application, you get the desired effect, a decrypted string from the encrypted settings file, now publish another entry, this makes a new line with "vbNewLine" and then encrypts it, fine and dandy. Now apon opening the application again, you get an error stating "Invalid character in a Base-64 string.". What do I do?

Encryption Code:
Public Function psEncrypt(ByVal sInputVal As String) As String
Dim loCryptoClass As New TripleDESCryptoServiceProvider

[code].....

View 6 Replies

Ntfs To Ext3 Reader And Writer?

May 25, 2009

this project im working on is giving me a headache. am trying to write a program to recognie both ntfs and ext3 fileformats and enable the copying of files between them. ive done the ntfs bit and my problem is how do i implement the ext3 file system reader and writer using visual basic.net.any references would be really useful.

View 1 Replies

Reading NTFS Mounted Drive

Feb 17, 2012

I have the code given below for reading and displaying all the drives on a computer.However,it does not read the NTFS mounted volume..I need the program just to read the mounted drive,

Module Module1
Sub Main()
For Each drive As String In System.Environment.GetLogicalDrives()

[Code].....

View 4 Replies

Reading The NTFS And FAT32 FAT/MFT Tables?

Mar 16, 2011

I am trying to find some VB code examples on how to read the MFT/FAT Tables from NTFS and FAT32 drives. I am trying to scan the drive and to detect all deleted files and unallocated clusters on a particular drive.

View 4 Replies

Datetime Format Conversion Invalid String

May 9, 2012

I have asked this question before and used the soln but for some reason it just does not work this time around. Hopefully someone else can see the error/missing element. Iparse a date that is in string format and would like to convert it to a datetime format but cannot figure out how to do this. The date appears as such:

[Code]....

View 1 Replies

Invalid Cast Exception When Assigning A String?

Jan 23, 2011

Dim NSNSRC As String = WebBrowser1.DocumentText

This throws me an error although DocumentText does have a value, I have also tried a .tostring after and it still did not work.

Surrounding Code:

While DocCompleated = False
System.Threading.Thread.Sleep(0)
End While

[Code].....

View 3 Replies

Invalid Connection String When Using Table Adapter?

Jan 17, 2011

I'm trying to use variables in my connection string to a table adapter. The only clean cut method I've seen is the following, however, I'm getting "Invalid Connection string" upon run-time. I'm assuming maybe this can't be done?

Private Sub adaptertest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'BCPM_DDBODataSet.LTC_FBS' table. You can move, or remove it, as needed.
LTC_FBSTableAdapter.Connection.ConnectionString = "Provider=TDOLEDB;Data Source=TDDEV;Persist Security Info=True;User ID={0};Password={1};Default Database=bcpm_ddbo;Session Mode=ANSI;"
Me.LTC_FBSTableAdapter.Fill(Me.BCPM_DDBODataSet.LTC_FBS)

View 2 Replies

VS 2008 - Apparently Invalid Connection String

Mar 20, 2009

Before I explain, the connection string I am trying to use is copied directly from elsewhere in the application that has always worked and still does.
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|cdb.rmd;
Persist Security Info=False;

My problem is that no matter if I go to "Server Explorer", "Data Sources", or any other option it will not let me add a datasource/database. Up to this point I have done everything at runtime but now due to reporting issues I need to create a dataset in design view.

This is what happens:
I click "Add connection..."
I choose "Microsoft Access Database File" (Which it is...)
I click "Continue"
Form shows up with a field for my connection string, which I insert (shown above).
I click "Ok"

I get the following error:
Format of the initialization string does not conform to specification starting at index 0.
The "Test Connection" button is apparently useless as the connection passes even if the field is blank.

I have attempted reducing the connection string to only what is absolutely necessary.
I have copied the string directly from connectionstrings.com replacing my filename.
I have renamed the file to an .mdb extension.
I have used the full path from C: all the way to the file.

View 10 Replies

VS 2010 : Conversion From String To Double Is Invalid?

Jul 25, 2011

I have written this code and tried running it but I am getting errors in the code segments below. The error says "conversion from string to double is invalid". whereas the calculation for 'y' is an addition so should not be giving the value it is giving at the moment. ICCPtotcircuitres is also returning 'nothing'.

Private Function iccptotcircuitres(ByVal x As String, ByVal y As String, ByVal z As String) As String
Dim Res As String
Res = x + y + z
iccptotcircuitres = Res

[code]....

View 7 Replies

Assessing NTFS User Folder Permissions?

Jul 9, 2009

Assessing NTFS user folder permissions

View 4 Replies

VS 2008 - How To Edit Share Permissions (not NTFS)

Jul 8, 2009

I need to build an app that can create a network share and give it full read/write permissions to everyone.
I have this code to create/delete network shares: [Code] But it only changes the NTFS permissions, not the share permissions. I'm running Windows 7 RC (64-bit) using Visual Basic 2008 Express. Does anyone have any ideas on how to change the share permissions, not ntfs?

View 1 Replies

Writing Of Files Leaves Corrupt NTFS?

Jul 3, 2007

Basically, we have an application which batch creates a large amount of files (pairs of PNG plus ASCII). The file count can exceed the one million.The first time the application ran the results were quite disappointing. The files get stored in folder structures of maximum 2000 files per folder. The tree depth gets only to two levels (root + packs folders). So the results would be stored in folders like "pack1","pack2"..."packn" each containing no more than 2000 files (1000 pairs in essence).

So getting back to the results, what happened was that although the application reported over 1.4 million files written, the results were that files were missing from the filesystem and others were corrupt (PNG cant be read and ASCII were blank filled with spaces).The speed that the files were written was not anything great (about 7 files per sec) and the total size ranged from 160K to 1.5M (rarely). The PNG images are 2000x2000 in size although I doubt it has anything to do with my problem.

Everything is done in pure .NET (image and ascii generation).The OS that has been tried was Win 2000 Advanced Server, Win 2003 Server plus XP Pro. The hardware ranged from Dual Core Workstation to high spec servers. The irony is that on the XP system the number of corrupt files was quite low where on the other two all hell broke loose. There were event logs written stating Event ID 2021 on the Win 2000 system and Paging faults on XP, which lead me to the next approach.

We wrapped the code to do an Application.DoEvents every second and refresh various statistic UI components. We obviously added Stream.Flush().Plus we added code to check the files (re-read them) once they are written. Even added "WriteThrough" option to avoid the OS cache! The result was stuggering as no errors were report yet the NTFS table again got corrupted!Now we inserted Thread.Sleep(100) after writing and then reading to confirm the file. Obviously this is slowing down the process but hope to have more stable results.

Reading and article about Event ID 2021 we saw it was suggesting to modify registry values, but the IT dep did not wish to accept this as they believe it is an application error.In pseudo code, here is more or less what is done:

<try>
<Create Image in memory>
<Open stream to filesystem>

[code]....

View 11 Replies

VS 2008 .DBF Connection String - Invalid File Path?

Sep 21, 2009

Dim dbconn As OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DS As New DataSet
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:COLORsitedataCUFORHDR.dbf;Extended Properties=dBASE IV;")

[Code]...

I prefer SQL server but im afraid in this app I have no choice. I think the .DBF file is v III dBase according to a thrid party .dbf viewer. The code explodes on the DBCommand.Fill(DS) line, telling me I have provided and invalid file path. The path is good to go.

Should I be using a driver with a different provider? When I remove the Extended Properties parameter I get an error unrecognizable database format - hinting in this case the path is correct.

View 3 Replies

List Deleted Files And Their Names From NTFS Drive

Mar 22, 2010

I'm trying to make a small app that reads MFT from a NTFS drive and lists deleted files and their names. The code is not ordered since its not finished yet. I made it basing on information a read at ntfs.com and some other examples found on the net. But the problem itself is the following. I have hard disk with to NTFS partitions, the main one having 250 GB and the second one having 1,5 GB. If I execute my code on the smaller drive, (using D as parameter for readfile api), I get the list of all deleted files exactly (I checked it with a recovery file app).

The problem is when I execute it on the other drive (C where Windows is installed, 7 if it matters), the problem is that I cant find any deleted file!!. The code gets all the files from MFT and then saves in a string variable only the deleted ones, I found that after deleting one file, it also disappears from the MFT (at least using my code). So, there may be some other way in which NTFS marks deleted files? As you see in my code, I iterate through the MFT entries and, from those that start with FILE, I take bytes 22 and 23 (0 base) and evaluate, if its value is 0 then its deleted, otherwise, it isn't (its a file or directory I think).

Public Structure SECURITY_ATTRIBUTES
Dim nLength As Integer
Dim lpSecurityDescriptor As Integer
Dim bInheritHandle As Boolean
End Structure
[Code] .....

View 3 Replies

Get An Invalid Cast Exception - Conversion From String To Double Not Allowed?

Apr 27, 2010

I get an Invalid Cast Exception - Conversion from string to double not allowed. I don't know what to do.

Option
Strict
On[code]......

View 14 Replies

Error - Invalid String. Looking For The Object With ProgID: Visdata.Visdataclass

May 4, 2009

I want to know about the problem. My problem is that when I open Visual Data Manager in Visual Basic Project I recieves a message "Invalid String. Looking for the object with ProgID: Visdata.Visdataclass".

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved