|
-
Nov 16th, 2000, 04:45 PM
#1
Thread Starter
Junior Member
I am using the CommonDialog and it selects my file fine but if you go to another text box on the form and type some information and happen to hit enter it pulls up the Showopen again? How do I get it to stop doing this?
-
Nov 16th, 2000, 04:52 PM
#2
_______
<?>
you must have Focus set to your command button
Posting your code would help one to see what is happening.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 16th, 2000, 04:57 PM
#3
Thread Starter
Junior Member
Code:
Private Sub Command1_Click()
If Check2 = 0 Then
' Set CancelError is True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Set flags
CommonDialog1.Flags = cdlOFNExplorer Or cdlOFNHideReadOnly
' Set filters
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files" & _
"(*.txt)|*.txt|Batch Files (*.bat)|*.bat"
' Specify default filter
CommonDialog1.FilterIndex = 1
' Display the Open dialog box
CommonDialog1.ShowOpen
' Display name of selected file
UploadFile = CommonDialog1.FileName
Exit Sub
Else
Dim strResFolder As String
strResFolder = BrowseForFolder(hWnd, "Please select a folder.")
If strResFolder = "" Then
Call MsgBox("The Cancel button was pressed.", vbExclamation)
Else
UploadFile = strResFolder
End If
CommonDialog1.
ErrHandler:
'User pressed the Cancel button
Exit Sub
End If
End Sub
Are you saying that I can just set the Command1 button to lostfocus?
-
Nov 16th, 2000, 05:03 PM
#4
_______
<?>
Perhaps your default focus is the commandbutton
Ie...if Command1.Default = True then whenever you hit enter you will activate the code in the button.
Put this in your form load event and try it.
Command1.Default = False
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 16th, 2000, 05:06 PM
#5
Thread Starter
Junior Member
Thank you the Command1 button was set to the Default--you guys are good.
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
|