I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a
button on that form pops up a FolderBrowserDi alog. As soon as the FBD
is closed, either by selecting or by cancel, the form exits. Not the
behavior that I was hoping for. Did I mess something up or is this the
way that it works? 7 1719
dgk wrote: I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a button on that form pops up a FolderBrowserDi alog. As soon as the FBD is closed, either by selecting or by cancel, the form exits. Not the behavior that I was hoping for. Did I mess something up or is this the way that it works?
Can we see some simplified code that shows the problem?
chris
On Sun, 31 Jul 2005 23:57:43 -0400, Chris <no@spam.com> wrote: dgk wrote: I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a button on that form pops up a FolderBrowserDi alog. As soon as the FBD is closed, either by selecting or by cancel, the form exits. Not the behavior that I was hoping for. Did I mess something up or is this the way that it works?
Can we see some simplified code that shows the problem?
chris
In the main form (during load if app settings aren't created yet):
Dim frmOptions As New frmOpts
Dim RCF As DialogResult = frmOptions.Show Dialog
If RCF = DialogResult.Ca ncel Then Environment.Exi t(1)
frmOptions.Clos e()
In frmOptions I declare this:
Private FBD As New System.Windows. Forms.FolderBro wserDialog
and in a button click event do this:
Private Sub btnBrowse_Click (ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnBrowse.Click
FBD.ShowNewFold erButton = True
Dim J As DialogResult = FBD.ShowDialog
End Sub
Click on the button, the Folder dialog pops up. Click either Ok or
Cancel and the folderbrowser exits, and so does the form. I can likely
stop it in OnClosing since that code is certainly firing, but I have
no idea why it is happening.
DGK,
How do you set that OK in your code.
Return dialogresult.OK as the button OK is clicked will probably fix the
job.
Be aware that there are some bugs in this by setting the button using the
designer to OK.
(I am not sure anymore what it was, so I never use this)
I hope this helps,
Cor
On Mon, 1 Aug 2005 07:06:19 +0200, "Cor Ligthert [MVP]"
<no************ @planet.nl> wrote: DGK,
How do you set that OK in your code.
Return dialogresult.OK as the button OK is clicked will probably fix the job.
Be aware that there are some bugs in this by setting the button using the designer to OK. (I am not sure anymore what it was, so I never use this)
I hope this helps,
Cor
I'm not sure that I understand this. I do set dialogresult.OK in the
OK button on the form, which is where the settings are actually
updated, but the OK that is from the FolderBrowserDi alog is part of
the sealed class and I can't do anything about it. Apparently
selecting either button on the FBD object is somehow satisifying the
need for a dialog result for the form. But if that was so, I wouldn't
be the first one writing about it. I've looked through two years of
messages and there are quite a few on ShowDialog but none mention
this.
dgk wrote: I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a button on that form pops up a FolderBrowserDi alog. As soon as the FBD is closed, either by selecting or by cancel, the form exits.
What is the DialogResult property of the button on your form set to? If it's
something other than None, this could result in the behaviour you described.
--
(O)enone
On Mon, 1 Aug 2005 13:30:48 +0100, "Oenone" <oe****@nowhere .com>
wrote: dgk wrote: I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a button on that form pops up a FolderBrowserDi alog. As soon as the FBD is closed, either by selecting or by cancel, the form exits.
What is the DialogResult property of the button on your form set to? If it's something other than None, this could result in the behaviour you described.
I hadn't set the DialogResult to anything yet. I just tried setting it
to None in Load and still got the same behavior. So I made a new
project with just the essentials, one form showing another with
ShowDialog(Me) and having a button on that form pop up the
FolderDialogBro wser. It worked fine. So something else is weird in my
project. Maybe a custom control that I'm also using on that form is
causing problems? I'll gut it and see what happens.
On Mon, 01 Aug 2005 13:23:14 GMT, dgk
<so************ ******@zero-spam-hotmail.com> wrote: On Mon, 1 Aug 2005 13:30:48 +0100, "Oenone" <oe****@nowhere .com> wrote:
dgk wrote: I'm showing a form using ShowDialog (VB2003 in Visual Studio), and a button on that form pops up a FolderBrowserDi alog. As soon as the FBD is closed, either by selecting or by cancel, the form exits.
What is the DialogResult property of the button on your form set to? If it's something other than None, this could result in the behaviour you described.
I hadn't set the DialogResult to anything yet. I just tried setting it to None in Load and still got the same behavior. So I made a new project with just the essentials, one form showing another with ShowDialog(M e) and having a button on that form pop up the FolderDialogBr owser. It worked fine. So something else is weird in my project. Maybe a custom control that I'm also using on that form is causing problems? I'll gut it and see what happens.
Ok, I have now added a new form and built the code back up until it is
a duplicate of the original problem form. It works fine. I have no
idea what is different but I'm on vacation today and I'M GOING TO THE
BEACH NOW. I just couldn't go until I had this fixed. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard L Rosenheim |
last post by:
I would like to detect when a form is invoked as the result of a ShowDialog
call.
Anyone have any ideas or suggestions on how to do that?
TIA,
Richard Rosenheim
|
by: Dennis Sjogren |
last post by:
Greetings!
First, I'm not 100% sure where to post this question. I use VB.NET for
this project, but it's really a design question (a question on which
method to use when solving this problem).
In this medium sized (30 or so forms) application, our users have
requested a more visual notification of when the client (this app) is...
|
by: Samuel R. Neff |
last post by:
I'm having weird results with a form that is already displayed modally
(via ShowDialog) displaying a second form via ShowDialog. The last
form is not modal even though it's called with ShowDialog.
For example, given three forms:
Startup
Pop1
Pop2
|
by: Richard L Rosenheim |
last post by:
I would like to detect when a form is invoked as the result of a ShowDialog
call.
Anyone have any ideas or suggestions on how to do that?
TIA,
Richard Rosenheim
|
by: Joe Duchtel |
last post by:
Hello -
I have the following code to detemine a file name when my application
is saving a file. The problem is that if the file already exists and
I select the Yes button in the "Do you want to replace" dialog, the
DialogResult is Cancel instead of OK. Is there something I am
missing?
Dim lSaveFileDialog As New SaveFileDialog
| |
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...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
| |
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |