Unexpected Directories With Environment.GetFolderPath
Aug 18, 2011
I am using following to get path to 'My Documents' folder in Windows 7 and iterate through its directories:
Dim diri As New DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Personal))
For Each diri In diri.GetDirectories
MessageBox.Show(diri.Name)
Next
One of the message boxes I get is for a 'My Music' folder. I do not have that folder in the 'My Documents' folder.
View 2 Replies
ADVERTISEMENT
Aug 6, 2009
I am using the following code to retrieve information about a folder on my computer.
My.Computer.FileSystem.FileExists(Environment.GetFolderPath(ProgramFiles)My problem is that the computer I am using has two operating systems installed. When running on the D: drive, the code returns the C: path. How can I get it to return the D: path?
View 1 Replies
Jul 29, 2011
This is currently the code I am using.
Dim fileList As Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(FolderDialog1.SelectedPath, FileIO.SearchOption.SearchTopLevelOnly)
For Each topLvlFile As String In fileList
[code]....
The above code reads all the files & directories in a selected path. It ignores any hidden folders, like it suppose to. Except it doesn't ignore folders inside of the hidden folders that it finds & I need it to.I can't quite wrap my head around how to make it ignore all folders & files inside of a hidden folder that it find.
View 3 Replies
May 3, 2010
[Code]....
it just creates 1 folder but not other folders with in folder.
View 1 Replies
Dec 15, 2009
I have VB6 Dll which I am referencing in vb.net ,I am calling the following function in it. It working fine in developemnt environment but not in deployement environment.
Error Method not found: 'Boolean MyUtils._MyUtils.LoadMyObjectRecords(ADODB.Stream ByRef, System.Array ByRef)'.
View 4 Replies
Jun 19, 2012
I need to list all files folders, subfolders and subfolder files under a selected directory in a list box not sure how to do the logic in the last amount of code lines to enumerate all subfolders dna files.Here is what I have so far:
Dim OldProfileDir As String
Dim NewProfileDir As String
Dim Newdocs As String = ""
Dim Olddocs As String = ""
[code].....
View 3 Replies
Jul 11, 2011
Basically I'm going to try and develop a software that merges PDFs automatically using the PDFSharp API.What I want in the program is to basically that: Have the program to give and Input and Output directoryMerge all the documents in the directory or sub-directoryRename the merged PDF file according the the name of the directory/sub-directoryIf the folder has PDF files and a Sub-Directory I want to merge the PDF files in the folder and rename them as per the main folder, and rename the files in the sub-folder according to its name (i.e. seperate|)
It's the first time I'm using an API.The problem I have is how to use the directories and sub-directories as I need them.
View 2 Replies
Jul 16, 2010
How can we prevent/stop unexpected Exception in .net. In my applicaiton there is an exception occurs randomly (sometimes my application works fine very long time, but sometimes that exception occurs and my application close). I do the following thing for prevent that unexpected exception.
In my Visual Studio 2008 -> Debug Menu -> Exceptions - > and unchecked all (Throw) and In User-unhandled all items are checked. But still i got that error.
View 10 Replies
Nov 29, 2009
In duplicated code using Lockbits in VB to obtain the address of Bitmap.Scan0, the first is OK, in all applications, but the second NEVER is. What is the explanation please? Surely both StartAddrA and StartAddrB should be valid pointers to Bitmap.Scan0 for calls to valid, functional ASM code in the functional DLL. The error is, it seems, in the VB Lockbits process. Using VS2010 Beta 2 and XP.
[Code]...
View 2 Replies
Apr 15, 2012
I'm flummoxed I'm using VB.Net, Linq, and a DataContext. My DataContext contains a table 'transactions'.
I first declare an IQueryable(Of transaction) and assign it to nothing. I build a predicate in a foreach loop and use a transactions.Where(predicate) to assign the IQueryable a value. If I do an IQueryable.ToList(), I get a number of items in the collection.
However, on the next iteration of the loop, the IQueryable.ToList() gives me 0 items.This is driving me crazy. I tried to use the LINQ to SQL Debug Visualizer with VS2010, (I recompiled the 2008 version with the new reference) but no dice - I can't see the SQl generated or what's inside the IQueryable.
[Code]...
View 2 Replies
Aug 18, 2011
How do I fix this error? I'm using asp.net Compilation Error.Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.
Compiler Error Message: CS1519: Unexpected symbol `Dim' in class, struct, or interface member declaration
Source code:<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
Dim dbconn As OleDbConnection
dbconn=New OleDbConnection("Provider=SQLOLEDB;
Data source='http://localhost';
[Code]...
View 3 Replies
Mar 30, 2012
I've inherited a VB website (I'm a C# developer by trade) and need to do some changes. On loading it into VS2010 it won't compile/run because it has a <!-- --> pair surrounding some code in the style section of each form and VS is saying this is an unexpected character sequence.I'm assuming it's a vb comment tag, but I've Googled it to with either making VS accept them, or advice on what to change them to so the original intent is not lost. NB I've tried <%-- which I use in C# but that doesn't appear to work either.
Example:
<html>
<head>
[code].....
View 1 Replies
Mar 10, 2011
Just when I was thinking that I had Linq To Xml sussed I'm faced with yet another error! I think if I was to understand the linq search process in general better I might have more success, so any good links regarding that are also welcome. To my problem however; using the code below:
[Code]...
View 1 Replies
Jul 10, 2009
In this line of code ".lim" is underlined and the error is that an End Of statement is expected,i wrote End Of at the end of teh code and the error did not dissappear.
Dim FileName As String = lsp ".lim" 'string containing the file name.
If you're not living on the edge, you're taking up too much room
View 5 Replies
Apr 21, 2009
What types of exceptions should be thrown for invalid or unexpected parameters in .NET? When would I choose one instead of another?
Follow-up:
Which exception would you use if you have a function expecting an integer corresponding to a month and you passed in '42'? Would this fall into the "out of range" category even though it's not a collection?
View 7 Replies
Sep 4, 2007
I am writing an app in VB2005 that makes a call to my cars ECU. It sends ok but during the DataReceived event I am getting an unusual result.I am trying to find out how many bytes are in the buffer so I can set up an array to write the data to so I have used the following.
intBTR = _Port.BytesToRead
_Port.Read(bytIncoming, 0, intBTR -1)
[code]......
View 3 Replies
Feb 4, 2009
Ok so i have a date time picker that holds a date that was entered by a user. My program works fine when ran on a computer using English(US) regional settings, but when i take it to a computer running any other regional settings, I.E. English(UK), which is the 2nd most common regional settings that will find its way to this program, I recieve an error because the Date format is backwards. What i'm curious about is how can i grab the system Regional Date format in order to rearrange my Date to fix its context?
I know that since the date is stored as a string i'm going to do something along the lines of this to break it apart:
Dim temp()
temp = Split(inputarray(7), "/")
inputarray(7) = temp(1) & "/" & temp(0) & "/" & temp(2)
i am almost 100% sure the above code will take a date in MM/DD/YYYY format and rearrange it to DD/MM/YYYY format.
View 2 Replies
Jan 21, 2008
Receiving following error:Error occured: An unexpected error occurred with the method.
Stack Trace: at MSProject.TimeScaleValue.get_Value()
View 4 Replies
Aug 19, 2010
We have an application (Vb6) that gets installed at all of our client sites and they often (Vista/Windows 7) run into a the error message Unexpected error, quiting after a install on a new machine. The problem comes about when the UAC is on and the application is trying to create registry entries in areas it doesnt have access to because the application is running as a standard user. If the user runs the application as an admin the first time, everything sets up and life if good.
My question is, what is the most elegant way to setup those registry keys without forcing the user to run as an admin the first time? We could force them to run the applicaiton as an admin using a manifest file, but I dont want them to have to run as an
admin every time, just the first time.
View 1 Replies
Feb 27, 2012
I'm having problems with the following Linq query (demandNb is a filter option, as a string):
[Code]...
My goal is to get all demands for the database if the filter fields is empty. If there is a filter, the function should return all demands that match the filter. Currently, when I try to convert the IQueryable collection to a list using .ToList(), the following error is thrown: Conversion from string "" to type 'Double' is not valid.
[Code]...
View 1 Replies
Sep 1, 2011
I did so by chosing "add existing file". For purposes to reproducing this let's say the file is in c:emp. So I added c: emphelp.chm.
I set the properties to "copy always" under the option "copy to output directory".
Then I compiled and it worked fine.
I then updated the file in c: emp with changes and compiled. I expected the updates would be copied into my program but they did not..
View 3 Replies
Feb 22, 2011
I am trying to open/read excel (2003) file in vb.net but I m keep getting "Unexpected error from external database driver (22)". I have also tried SSIS but same error pops up. I have used following connection strings but none of them seem to be working:
conn.ConnectionString = "Driver={Microsoft Excel Driver (*.xls)};" & _
"Driverid=790;" & _
"Dbq=C:Report_1.xls;" & _
"DefaultDir=C:;"
View 2 Replies
Jul 8, 2011
If txtLog is a RichTextBox control:
Dim text = "hi" & vbCrLf
Debug.WriteLine("t:" & text.Length) ' --> 4, as expected
txtLog.Text = text
Debug.WriteLine("tL:" & txtLog.TextLength) ' --> 3. muh?! :(
Having looked at the RTF spec, the end of a paragraph is notated as par, which is neither CR nor LF. This makes sense since RTF is markup language; like in HTML, line endings have little meaning on their own.
So presumably, on writing into the RichTextBox, my line ending is being encoded into par. And then, on extraction, the par is being translated back to a real line ending for use.
It turns out that this line ending is vbLf.
Why, since Microsoft near-consistently employ CRLF for line endings, would RichTextBox translate par to vbLf instead of vbCrLf?
View 2 Replies
Jun 21, 2010
I'm attempting to load an xml document from an XML column in MSSQL 2008, into an XmlDocument (see code below).
Sometimes the code will break at the xdoc.Load(xr) line with the error "Unexpected end of file and occurred". After breaking, the XmlReader has a value of "None".
While researching the problem, I saw posts that referred to a 4Kb limit on StreamReaders and figured this may be related somehow. So I cut down the size of my document (to around 4Kb) and everything worked fine.
On average, the XML documents I'm importing from the database are 20Kb.
how to get a 'large' amounts of XML from the database into my XmlDocument?
Dim xr As XmlReader = ExportAdapter.GetEditedCheckXML(chkId)
Dim xdoc As New XmlDocument
xdoc.Load(xr)
[Code].....
View 1 Replies
Feb 20, 2009
Consider the following snippet:
Dim Arext() = {"*.ttf","*.ttc"}
For Each foundFile In FileSystem.GetFiles(srcdir, SearchOption.SearchTopLevelOnly, arExt)
[code]....
The unexpected result is that not all the files specified in arext() are returned by this code. Running the same code twice on the same subset of files does NOT produce consistent results.I'm seeing, probably, 90% of the files with the other 10% not being included?
View 1 Replies
Apr 11, 2012
I've two Strings which I'm loading from a SQL Server 2008 database (nvarchar-field)After loading them from the database Visual Studio 2010 displays them as follows in the watch window:
str1 = "Test"
str2 = "Test"
But the comparison with str1 = str2 returns False If I write those strings to a file with UTF8 Encoding the result is as expected:
Test
Test
If I write those strings to a file with ANSI (Default) Encoding the result is NOT as expected:
?Test
Test
Converting the strings to bytes:
System.Text.Encoding.Default.GetBytes(str1) 'Returns ByteArray {63, 84, 101, 115, 116}
System.Text.Encoding.Default.GetBytes(str2) 'Returns ByteArray {84, 101, 115, 116}
System.Text.Encoding.UTF8.GetBytes(str1) 'Returns ByteArray {239, 187, 191, 84, 101, 115, 116}
System.Text.Encoding.UTF8.GetBytes(str2) 'Returns ByteArray {84, 101, 115, 116}
Where is the Byte 63 in case of ANSI Encoding OR Bytes 239, 187, 191 in case of UTF8 Encoding for str1 coming from?Well, Bytes 239, 187, 191 are the BOM for UTF8. The question here would more likely be: Why do I get the BOM for str1 but not for str2?(Well, the values are values passed to a webservice which inserts them into the database, the initial values are passed to this webservice by a client I've no control over)
View 3 Replies
Mar 17, 2011
I am reading a large number of XML files and do not want my program to bomb on exceptions. I am making great strides in reporting the errors, skipping the offending files and continuing the import process. However I am having problems with XmlExceptions. I get the following XmlException on the While textReader.Read() line of my program:
Quote:
XmlException was unhandled
Unexpected end of file has occurred. The following elements are not closed:
my:PicInsert, my:PictureGroup, my:myFields. Line 153, position 430817.
I am finding some of the reasons why, missing tags etc, but those aren't really my concern. I just want to report the issue and continue. I am thinking about some kind of check for a valid xml file but fear that that might not catch it all. For example I had a image tag in one of the files that was missing an alt="" attribute and I am not sure if that would invalidate the entire XML file.What would be the best way to trap and deal with the exception with out causing interuption to the program?
View 2 Replies
Dec 6, 2011
OS: Win7 64bits Software Tools:Package and Deployment Wizard (for VB6.0)The vbp file is working in XP. Installed the VB6.0 in Win7 64bits, it can make the exe file.However, the setup file can be made using the 'Package and Deployment Wizard' Tool.
View 2 Replies
Oct 22, 2009
The following syntax is just fine ReadOnly
[Code]...
View 3 Replies
Dec 29, 2010
Here's the
CanTest = CanTest OrElse (DateTime.Now.Subtract(LastTest).Hours >= 1)
If CanTest Then
[code]....
However, when I change it to 65 minutes instead of 1 hour, it acts up. The time until next question starts going up instead of down... The only thing I changed is 1 hour to 65 minutes:
CanTest = CanTest OrElse (DateTime.Now.Subtract(LastTest).Minutes >= 65)
If CanTest Then
If InputBox(Question(Cur), "Question #" & cur.ToString("###,##0")) = Answer(Cur) Then
[code]....
View 6 Replies