|
-
Oct 12th, 2000, 01:10 PM
#1
Thread Starter
Lively Member
validation and button problem
I have a textbox for a filename to be entered by the user or retrieved from the browse dialog box. I have a button that brings up a browse(open) dialog box to select the file.When the cursor is in the textbox, the browse button becomes visible. The problem is that when the file doesn't exist a msgbox shows up and then the textbox is highlighted, but when I want to go and browse the validation occurs and can never get out of the box until a valid filename is entered.
I want to be able to get out of the box without validation only when the user is going to the browse button. Otherwise, run the validation.
Private Sub txtSeaFloor_GotFocus()
cmdBrowse.Visible = True
End Sub
Private Sub txtSeaFloor_LostFocus()
If Me.ActiveControl = cmdBrowse Then
If Me.ActiveControl.Caption <> "Browse" Then
cmdBrowse.Visible = False
End If
Else
cmdBrowseEnv.Visible = False
End If
End Sub
Private Sub txtSeaFloor_Validate(Cancel As Boolean) 'environment tab
If txtSeaFloor <> "" Then
If Dir$("c:\grid\" & txtSeaFloor) <> "" Then
' MsgBox "File exists"
Else
MsgBox "File does not exist. Please enter another file or browse."
Cancel = True
Call highlightselection(txtSeaFloor)
txtSeaFloor.SetFocus
End If
Else
MsgBox "Need to select a seafloor file"
Cancel = True
Call highlightselection(txtSeaFloor)
txtSeaFloor.SetFocus
End If
End Sub
Thank you.
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
|