Focusing OpenFileDialog control

  • Thread starter Thread starter LEE
  • Start date Start date
L

LEE

I used an OpenFileDialog control, it was not focused every
time it was called. How to focus it?

Thanks
 
Hi Lee,

Can you tell something more, because normaly it gets direct the focus?
(Otherwise show with code how you do it)

Cor
 
Hi,

I did try it, but it was showed up all the time with focus in the filename
textbox.

Did you know this is terrible bad code you use.
A catch block without an action on the catch from the exception.

But what does not get the focus, because it did work al the time with your
code before I did change it to this.
(And I think there is something more because you made that try catch block)
:-)
Cor

\\
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim openFileDialog1 As New OpenFileDialog
openFileDialog1.Filter = "Excel files (*.xls)|*.xls"
openFileDialog1.FilterIndex = 2
Dim fileName As String
If openFileDialog1.ShowDialog() = DialogResult.OK Then
fileName = openFileDialog1.FileName
End If
End Sub
///
 
Hi Cor,

The codes in catch was removed, and I didn't think it was
an issue of that. One more thing I didn't tell you is that
the codes were run at an asynchronous process. I only want
to know if there is a way to force fucosing the dialog.

Thanks
 
Back
Top