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.thanks ^_^
3 1898
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 ' MessageBoxOptions.DefaultDesktopOnly ' ,
from the help - ' DefaultDesktopOnly 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...
|
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...
|
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...
|
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....
|
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: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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,...
|
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...
| |