473,785 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stop Minimizing the form

20 New Member
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:

Expand|Select|Wrap|Line Numbers
  1.  Dim SaveChangesResponse As DialogResult
  2.         SaveChangesResponse = MessageBox.Show("Are you sure you want to save changes?  " & _
  3.                     "Changes done here are permanant.", _
  4.                     "Save Changes?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, _
  5.                    MessageBoxDefaultButton.Button2, _
  6.                    MessageBoxOptions.DefaultDesktopOnly, False)
  7.  
  8.         If SaveChangesResponse = Windows.Forms.DialogResult.Yes Then
  9. 'this is when the window starts minimizing
  10.  
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 ^_^
Nov 1 '08 #1
3 1915
qazplm114477
20 New Member
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

Expand|Select|Wrap|Line Numbers
  1. MainForm.StatusLabel.Text = "Attempting to save changes for vendors"
  2.         Dim SaveChangesResponse As DialogResult
  3.         SaveChangesResponse = MessageBox.Show("Are you sure you want to save changes?  " & _
  4.                                               "Changes done here are permanant.", _
  5.                                               "Save Changes?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, _
  6.                                             MessageBoxDefaultButton.Button2, _
  7.                                             MessageBoxOptions.DefaultDesktopOnly, False)
  8.  
  9.         If SaveChangesResponse = Windows.Forms.DialogResult.Yes Then
  10.             'the code for saving all changes done in the vendors
  11.             Dim RowsAffected As Integer = 0
  12.             Try
  13.                 VendorBindingSource.EndEdit()
  14.                 RowsAffected = TbL_VENDORTableAdapter1.Update(VendorViewDataSet1.TBL_VENDOR)
  15.                 If RowsAffected > 0 Then
  16.                     MainForm.StatusLabel.Text = "You have updated  '" & RowsAffected.ToString() & "' Row(s)"
  17.  
  18.                     MessageBox.Show("No problems encountered", "Sucessfull")
  19.                 Else
  20.                     MainForm.StatusLabel.Text = "A problem was encountered during updating. Could not save into the database"
  21.  
  22.                 End If
  23.             Catch ex As Exception
  24.                 MessageBox.Show("Problem Updating vendor: " & ex.Message)
  25.             End Try
  26.         Else
  27.             'TODO: make sure window dosen't minimize after clicking no
  28.             MainForm.StatusLabel.Text = "Edit folder operation cancelled."
  29.         End If
  30.  
  31.     End Sub
Nov 1 '08 #2
jg007
283 Contributor
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. '
Nov 1 '08 #3
qazplm114477
20 New Member
hello jg007, thank you so much, this solved my problem completely. I was wondering what that option does ^_^
Nov 1 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

12
2277
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
3
3094
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.
13
1375
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...
4
1772
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
7
9335
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
1
1045
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
5
3493
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")
0
1002
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
2
1040
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.
0
9480
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,...
0
10327
Oralloy
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...
1
10092
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,...
0
9950
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8973
agi2029
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...
0
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
3
2879
bsmnconsultancy
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...

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.