Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Member 12886468

@Member 12886468
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem Setting OpenFileDialog.InitialDirectory
    M Member 12886468

    I struggled with the same problem. When I set the AutoUpgradeEnabled to True, it started working better. But I added the below code and it seems to always works now.

    Public Class frmSample

    	Dim openFileDialog1 As New OpenFileDialog()
    
    	Dim sTemp As String
    
        Private Sub btnOpen\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)       Handles btnOpen.Click
    
        	openFileDialog1.AutoUpgradeEnabled = True
    
        	sTemp = "None"
        	sTemp = OpenDir()
        	Do Until sTemp <> "None"
            		'Nothing
        	Loop
    	'The above loop is my solution.
    	'It makes sure that the initial directory is known, before 
                'continuing to If OpenFileDialog1.ShowDialog
    
        	openFileDialog1.Filter = "txt files (\*.txt)|\*.txt|All files (\*.\*)|\*.\*"
        	openFileDialog1.FilterIndex = 0
        	openFileDialog1.RestoreDirectory = True
    
        	If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
    
            		'Enter your code
    
        	End If
    
    	End Sub
    
        Private Function OpenDir() As String
    
        	openFileDialog1.InitialDirectory = "C:\\Sample Initial Directory"
        	Return "OpenDir"
    
    	End Function
    

    End Class

    Visual Basic csharp visual-studio winforms help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups