Hi, I'm having a tiny problem. I have just started playing around with visual basic a week ago so im fairly new at this. I created a method that saves changes when you click a button, once the button is clicked a message box pops up with a yes/no option. whenever i click any of those buttons the entire window minimizes. Theres no problem with the code it self yet, i just want my window to stop minimizing
here is the code: - Dim SaveChangesResponse As DialogResult
-
SaveChangesResponse = MessageBox.Show("Are you sure you want to save changes? " & _
-
"Changes done here are permanant.", _
-
"Save Changes?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, _
-
MessageBoxDefaultButton.Button2, _
-
MessageBoxOptions.DefaultDesktopOnly, False)
-
-
If SaveChangesResponse = Windows.Forms.DialogResult.Yes Then
-
'this is when the window starts minimizing
-
the source of this code is in form2 which i pull up with form1(which both minimizes).
any help would be greatly appreciated.tha nks ^_^
3 1915
I think the problem has something to do with the status label in form one, because every time a click event is triggered in form2, i would display what happened in the status lable in form 1 (StatusLable in a statusStrip ofcourse)
here is the entire code - MainForm.StatusLabel.Text = "Attempting to save changes for vendors"
-
Dim SaveChangesResponse As DialogResult
-
SaveChangesResponse = MessageBox.Show("Are you sure you want to save changes? " & _
-
"Changes done here are permanant.", _
-
"Save Changes?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, _
-
MessageBoxDefaultButton.Button2, _
-
MessageBoxOptions.DefaultDesktopOnly, False)
-
-
If SaveChangesResponse = Windows.Forms.DialogResult.Yes Then
-
'the code for saving all changes done in the vendors
-
Dim RowsAffected As Integer = 0
-
Try
-
VendorBindingSource.EndEdit()
-
RowsAffected = TbL_VENDORTableAdapter1.Update(VendorViewDataSet1.TBL_VENDOR)
-
If RowsAffected > 0 Then
-
MainForm.StatusLabel.Text = "You have updated '" & RowsAffected.ToString() & "' Row(s)"
-
-
MessageBox.Show("No problems encountered", "Sucessfull")
-
Else
-
MainForm.StatusLabel.Text = "A problem was encountered during updating. Could not save into the database"
-
-
End If
-
Catch ex As Exception
-
MessageBox.Show("Problem Updating vendor: " & ex.Message)
-
End Try
-
Else
-
'TODO: make sure window dosen't minimize after clicking no
-
MainForm.StatusLabel.Text = "Edit folder operation cancelled."
-
End If
-
-
End Sub
I think this is because you are using ' MessageBoxOptio ns.DefaultDeskt opOnly ' ,
from the help - ' DefaultDesktopO nly will cause the application that raised the MessageBox to lose focus. '
hello jg007, thank you so much, this solved my problem completely. I was wondering what that option does ^_^
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Vadym Stetsyak |
last post by:
Hi there!
Is there any way how can I stop garbage collection for a period of time.
Lets say, I have a form. Before form load I pause the GC and when the form
is shown resume GC
|
by: NL |
last post by:
Hi,
Does anybody know how to turn off the animation Windows does with a window
as it's minimized/maximized to the taskbar?
I have an app which, when minimized, syncs to any other open instances of
the app and tells them to minimize. If I have more than a couple instances
open, the user ends up waiting quite a while for all of windows to minimize,
since each minimizing animation is done consecutively and not in parallel.
|
by: Nathan |
last post by:
Hello again,
I have an application with three forms. Frm1 has a button whose click event
calls frm2 -- frm2.ShowDialog(). Frm2 has a button that calls frm3 --
frm3.ShowDialog(). When I minimize frm3, I want the other two forms to
minimize as well. As I have it now, frm3 minimizes and a small title bar
appears at the lower left of my desktop, and frm2 and frm1 remain in the
center and I cannot touch them because of ShowDialog. (I...
|
by: Tony Clark |
last post by:
Hi,
How can i tell when a form is minimizing or closing by use of the button in
the top right of the form?
thanks in advance
|
by: Lee |
last post by:
Hi,
How do I detect when a form is minimizing? specifically when a user clicks
the show desktop button on the taskbar, rather than the minimize button on a
form.
thanks in advance
| |
by: Zectron |
last post by:
I have made my custom application from which i can access all other
installed application using Shell function. I need to send this application
to system tray upon minimizing. How to do it?? Please help!!
--
Regards
|
by: Scott |
last post by:
Hi everyone,
I have a c# console app that when run through an autorun.inf file, launches
a web page from the CD. It works just fine but I would like the console
window minimized on startup. Currently, the console window displays briefly,
the web page loads, and the console window disappears.
The only line of code currently in the console app is...
System.Diagnostics.Process.Start("blahblahblah.htm")
|
by: zyxwvu |
last post by:
Dear All,
I am developing project. on minimizing the from it should go to the system tray and not show on the task bar.. could u please help me in this way.
Thanks and Regards
Ravikrishnakumar
|
by: kimiraikkonen |
last post by:
Hi,
Maybe simple, but i couldn't find the correct class for minimizing
current form when a "button" is clicked.
Thanks.
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |