|
-
Aug 7th, 2002, 07:52 AM
#1
Thread Starter
PowerPoster
*Resolved*In my series of simple questions on VB.Net, Heres another one
In VB6 we had the combination of drive + dir box, hey I do not want to use the compatibility.VB6
thingy...I just want to know the equivalent in .NET...anyone?
Last edited by veryjonny; Aug 9th, 2002 at 12:58 AM.
-
Aug 7th, 2002, 08:25 AM
#2
Do you mean the .NET equivilant of the shBrowseForFolder class?
-
Aug 7th, 2002, 01:57 PM
#3
Thread Starter
PowerPoster
hi Cander,
Forgive me for ignorance, but I am not sure what do you mean by shBrowseForFolder ...I dont think I have come across it in .NET yet or maybe VB6
But it did give me a start.
Here's the code of what I was trying to achieve:
Code:
Set s = CreateObject("Shell.Application")
s.browseforfolder Me.hWnd, "Please choose folder:", 0
Set s = Nothing
This displays the choose folder thingy even in .NET,however I have no idea how to get the return
value( the folder selected).
The browseforfolder, I did get in object browser - under Shell32.shell but have no knowledge, how
to use it in VB through early binding (dim x as something)
Also, if you remember you suggested it to me once that I shd use the object browser like a huge
search engine - however just like this example - Even if I find something in it , I do not
actually understand - how to use it in code - the help files associated in .NET documentation
also arent much useful, I mean atleast I cant find what i am looking for.
Also , I hope you wont mind looking at this thread as well.
http://www.vbforums.com/showthread.p...hreadid=190432
-
Aug 7th, 2002, 02:06 PM
#4
Code:
Imports System
Imports System.Windows.Forms
Imports System.Windows.Forms.Design
Public Class BrowseForFolder
Inherits FolderNameEditor
Dim fBrowser As FolderNameEditor.FolderBrowser
Dim fDir As String
Public Sub New()
fBrowser = new System.Windows.Forms.Design.FolderNameEditor.FolderBrowser()
End Sub
Public Function ShowIt(ByVal textdescription As String) As DialogResult
fBrowser.Description = textdescription
Dim res As DialogResult = fBrowser.ShowDialog()
fDir = fBrowser.DirectoryPath
return res
End Function
Public Property Directory As Sting
Get
return fDir
End Get
End Property
End Class
add a refernce to System.Design.dll for this to work
to use...
Dim fBrowse As BrowseForFolder = new BrowseForFolder()
If fBrowse.ShowIt("Select a directory to extract to.") <> DialogResult.Cancel Then
MessageBox.Show(fBrowse.Directory)
End Id
-
Aug 7th, 2002, 02:10 PM
#5
Thread Starter
PowerPoster
hoya, thanks a lot cander.
But shdnt that be complete spoon feeding me
Really cant get a hang of VB7
-
Aug 7th, 2002, 02:17 PM
#6
I wouldnt call it spoon feeding..Actually it took me a LONG time to figure that out..it wasnt documented and I had to play around with it.
I originally wrote it in C# and quickly trasnfered it to VB, so I hope that works right!
-
Aug 7th, 2002, 02:19 PM
#7
Thread Starter
PowerPoster
Thats mean you are well-versed with C# as WELL
-
Aug 7th, 2002, 02:22 PM
#8
Originally posted by veryjonny
Thats mean you are well-versed with C# as WELL
Pretty much yeah. I find it very useful to know both C# and VB. That way, when I need to find some sample code, no matter wether it is C# or VB .NET, I can understand it.
-
Aug 8th, 2002, 05:00 PM
#9
PowerPoster
I am not sure if this is what you want, but you can still get those controls in your toolbox by right clicking it, then selecting customize toolbox. The .Net tab has the drive list box and folder listbox in there.
Again, I didn't go through this whole post, just thought I would throw that out.
-
Aug 9th, 2002, 12:50 AM
#10
Thread Starter
PowerPoster
Thanks for the post - I was looking for .NET equivalent rather than VB6 compatibility one.
But the post by Cander did the needful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|