reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1
reading from VB and windows 8.1 reading from VB and windows 8.1
reading from VB and windows 8.1
Go Back  Xtreme Visual Basic Talk > > > reading from VB and windows 8.1


Reply
 
Thread Tools Display Modes
  #1  
Old 03-06-2014, 12:11 PM
kguarino kguarino is offline
Regular
 
Join Date: Nov 2005
Posts: 75
Angry reading from VB and windows 8.1


I have VB code that reads in a text file from a specific location to give my application info that can be controlled by the end user, such as the location of a database. Previously the config file location was in a "c:\program files..." directory. That does not fly in Windows 8, nor does "This PC\documents.." How would I access a windows 8 file?
Reply With Quote
  #2  
Old 03-06-2014, 02:49 PM
PlausiblyDamp's Avatar
PlausiblyDampreading from VB and windows 8.1 PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Easiest way is to use the SpecialFolder enumeration to locate where the file is. If the file needs to be system wide then SpecialFolder.CommonApplicationData is probably best, if it needs to be per user then SpecialFolder.ApplicationData is more suitable.

The example on the linked page should give you an idea how to use the enumeration to obtain a folder path.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 03-07-2014, 11:21 AM
kguarino kguarino is offline
Regular
 
Join Date: Nov 2005
Posts: 75
Default

Thanks for the reply. I did some more poking around. The error I get is an access error trying to get to c:\program files\... file, even though the directory gives read-only access.

I am using System.IO.FileStream(strFilePath, IO.FileMode.Open) to get to it.

I wanted to use the program files directory to hold my application config file scine I know this will reside on my target machines.

Any clue on how to be able to access the file?
Reply With Quote
  #4  
Old 03-07-2014, 11:52 AM
kguarino kguarino is offline
Regular
 
Join Date: Nov 2005
Posts: 75
Default

Also - the properties of the file I am trying to access states it may be blocked because it came from another computer. I selected "unblock" but it remains blocked. I tried to create another file and could not, the error states I need to be the administrator. My account is an administrator account. I tried to unset the "read-only" attribute on the folder and have the same issue, it states I am not the administrator.
Reply With Quote
  #5  
Old 03-07-2014, 01:44 PM
PlausiblyDamp's Avatar
PlausiblyDampreading from VB and windows 8.1 PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Try using the http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx overload and specify read access for the third parameter.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1 reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1 reading from VB and windows 8.1
reading from VB and windows 8.1
reading from VB and windows 8.1
 
reading from VB and windows 8.1
reading from VB and windows 8.1
 
-->