Wrox Programmer Forums
|
BOOK: Beginning Microsoft Visual Basic 2010
This is the forum to discuss the Wrox book Beginning Visual Basic 2010 by Thearon Willis, Bryan Newsome; ISBN: 9780470502228
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual Basic 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2012, 12:29 AM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 2 Times in 2 Posts
Red face ch8 FolderBrowserDialog strange behavior

I have done some win32 programming with another version of basic. In the past, I have used an environment variable and then concatenated a string to get the filepath (string to plug into file info structure) that I desire. This technique does not work here. I know I am getting some kind of enumeration but I don't know what to do about it.

The example or project on page 273 uses the line shown below for the "RootFolder" of the FolderBrowserDialog which I changed while I was fooling around with the code to see how I could use it for my own programs. That is what I like about this book, you can twiddle with the code and watch the debugger while reading the "How it works" to see how things . . . um . . . work.

Code:
rem original line in book below, works fine
.RootFolder = Environment.SpecialFolder.MyComputer
rem changed to: (this does not work)
Dim mystr As String
            mystr = Environment.SpecialFolder.Windows
            mystr = mystr + "system32"
            'MsgBox(mystr)

rem this works:
    .RootFolder = Environment.SpecialFolder.Windows
rem but I want a folder below this.
Why won't my code change work? Somehow I get an integer instead of a string. How can I use the specialfolder method to get to system32 or anywhere I want? I might want to use relative addressing from some common folder like "windows" or the user "documents" folder as a starting point.

thanks,
 
Old February 18th, 2012, 02:38 AM
Registered User
 
Join Date: Feb 2012
Posts: 1
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Bro sorry I maybe way off. i'm just starting this book but I did mess around with 2008. I could be wrong but I see 2 possible problems.

1. you are setting a folder object to a string variable. see if ".tostring" is available here.

Quote:
mystr = Environment.SpecialFolder.Windows
2. You are forgetting the / when adding system32 folder.


Also check this page out. There are other options to get the system folder other then appending to a string!!

http://msdn.microsoft.com/en-us/libr...ialfolder.aspx


Let us know if this helped at all!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange SaveAs behavior Shankar_R Excel VBA 4 February 12th, 2010 02:29 AM
Strange Behavior With Anchor in XSLT kwilliams XSLT 6 July 21st, 2005 01:52 PM
Strange behavior Listview under XP pavel Pro VB 6 1 June 1st, 2005 05:14 AM
STRANGE behavior..SQL Help skotman Classic ASP Databases 7 June 6th, 2004 02:55 PM
Strange behavior of DateTimePicker? wwz VS.NET 2002/2003 0 February 19th, 2004 06:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.