Results 1 to 10 of 10

Thread: *Resolved*In my series of simple questions on VB.Net, Heres another one

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    *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.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Do you mean the .NET equivilant of the shBrowseForFolder class?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    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

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    hoya, thanks a lot cander.

    But shdnt that be complete spoon feeding me

    Really cant get a hang of VB7

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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!
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    Thats mean you are well-versed with C# as WELL

  8. #8
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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.

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    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
  •  



Click Here to Expand Forum to Full Width