473,587 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Focusing OpenFileDialog control

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

Thanks
Nov 20 '05 #1
3 1743
Cor
Hi Lee,

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

Cor

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

Thanks

Nov 20 '05 #2
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(B yVal sender As System.Object, _
ByVal e As System.EventArg s) 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
///
Nov 20 '05 #3
Lee
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

-----Original Message-----
Hi,

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

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 yourcode 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(B yVal sender As System.Object, _ ByVal e As System.EventArg s) 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
///
.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5707
by: Lina | last post by:
Hello, I wanted to ask if anyone can help me complete the following code. I found this example while searching through help documnets. What i want to achieve is to open a dialog box that lets the user select an images file. I am using the openFileDialog control. Here is what i have done so far for the onlick event for the button...
1
2323
by: Johann Blake | last post by:
A number of posts have indicated developers having problem getting an OpenFileDialog to startup in a specific directory when the dialog is shown. The first time you show the dialog, the InitialDirectory will cause the dialog to show files in that directory. However, any further times that the dialog is displayed, the directory that is shown...
3
4030
by: cider123 | last post by:
Everything I've read so far states you can't inherit or extend these dialogs because they're "sealed". I considered building my own custom control, but I haven't been able to find: 1) How to add a "Places Bar" to a form 2) How to hook a Combo Box into System locations like the existing OpenFileDialog / SaveFileDialog offer (ie. "My...
6
2998
by: barbara_dave | last post by:
Hi, All, I want to use the openfiledialog to open different extension files in different directory( only one type files at one time). I set the OpenFiledialog InitialDirectory and Filter property for ".dat" files at first time, it works. When I try to use openfiledialog to set different InitialDirectory an different Filter property for...
5
1845
by: De kessé | last post by:
Im trying to do this from ASP.NET and it does not work. Dim ofd As New OpenFileDialog Openfiledialog is not there. But I can find it in the object browser. In my web config i can see this <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
0
1178
by: Gregaz | last post by:
I have a form in my project, which I open as a DialogBox. On that that form there are 3 TextBoxes. To one of them I want to write in a file path. To have it easier I have an OpenFileDialog control on my form. Selected file path is written in to th TextBox. OpenFileDialog is open by click on a Button. There is other Button on the form run...
6
872
by: Mike | last post by:
Hello all, I'm trying to work with the openfiledialog and being new to vb and vb.net I'm having some problems. Wherever I have Me.OpenFileDialog1 I keep getting the following error: C:\Visual Studio Projects\ImageLoad\OpenFileDialog1.vb(66): 'OpenFileDialog1' is not a member of 'ImageLoad.OpenFileDialog1'. Can someone please tell me why...
1
3005
by: =?Utf-8?B?TW9uaWNh?= | last post by:
Hi 1- I want to pick a file in my website project using asp.net 2- I added System.Windows.Forms by add references to my project. 3- I attach a button to my project. 4- in side Button1_Click(object sender, EventArgs e) I wrote: OpenFileDialog filedlg = new OpenFileDialog(); filedlg.Title = "Choose an image to upload";...
3
3245
by: Martijn Mulder | last post by:
It strikes me that System.Windows.Forms.OpenFileDialog seems te 'remember' which directory it was in last, even when a new OpenFileDialog-object is created for every access to the file system. This 'persistence' also holds between different invocations of the same program. Even when the .cs file is re-compiled, the OpenFileDialog again opens...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.