473,657 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prompt user if changes made are updated or not

16 New Member
how do i tell the user if the changes made in an open window or form on vb.net are updated or not after accidentally closing the window?
Jul 12 '07 #1
3 1235
dip_developer
648 Recognized Expert Contributor
how do i tell the user if the changes made in an open window or form on vb.net are updated or not after accidentally closing the window?
plenty of ways to do that.........
but the simplest is..

take a flag(a variable)....af ter a successful updation change the flag value......then while closing the form just check the value........

suppose you have a button (say btnClose) to close the form....first declare a variable as
Expand|Select|Wrap|Line Numbers
  1. Dim flag as string="not_upadated"
change the value of 'flag' after updation as
Expand|Select|Wrap|Line Numbers
  1.  flag="updated"
then check the value while closing the form in btnClose_Click event

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
  3.  
  4. If flag="updated" Then
  5. Me.Close()
  6. Else
  7. Exit Sub
  8. End If
  9.  
  10. End Sub
  11.  
Jul 12 '07 #2
tabakaka
16 New Member
plenty of ways to do that.........
but the simplest is..

take a flag(a variable)....af ter a successful updation change the flag value......then while closing the form just check the value........

suppose you have a button (say btnClose) to close the form....first declare a variable as
Expand|Select|Wrap|Line Numbers
  1. Dim flag as string="not_upadated"
change the value of 'flag' after updation as
Expand|Select|Wrap|Line Numbers
  1.  flag="updated"
then check the value while closing the form in btnClose_Click event

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
  3.  
  4. If flag="updated" Then
  5. Me.Close()
  6. Else
  7. Exit Sub
  8. End If
  9.  
  10. End Sub
  11.  
what if closing the window is not by a button, but by the X in the title bar(minimize, restore, CLOSE)? by the way its a web form.
Jul 12 '07 #3
radcaesar
759 Recognized Expert Contributor
Form Unload or Closing events are there to track this.
Jul 12 '07 #4

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

Similar topics

7
19288
by: Petesman | last post by:
I am trying to make a prompt that will ask the user for some input... If I just use var input = prompt("dafa") everything works fine but the box is put in the top left corner of the window. I need it to be centered so... I was doing some research on the net (never really used much JavaScript before) and was reading the only way to do this is by making your own custom prompt. In my attempts of doing so I came up with this code below. The...
2
2243
by: icedgar | last post by:
am using the following script in the BeforeUpdate area of a main form. Private Sub Form_BeforeUpdate(Cancel As Integer) Dim strMsg As String strMsg = "Do you wish to save your changes?" If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then 'do nothing Else
0
1279
by: tafs7 | last post by:
Hello, I have a custom datagrid control that works great. But I was thinking about adding some functionality to it. Currently, I use the datagrid to display one record at a time, and with item templates, if you click the edit button, the datagrid becomes a nice form to make changes. Kinda like a big rolodex, and as you page you flip thru each record individually. My question is this: how can I have some kind of server side script
4
2746
by: Guadala Harry | last post by:
Is there any way for one Session to remove and update objects in another Session? I seriously doubt it, but thought I'd ask. Here's why: I have some data that is unique per user (or per session - similar to "welcome back, Jim" after Jim logs in) and consumed across multiple pages. This "per user" data lives in a database, so toward improving runtime performance I want to cache data supporting this and similar per user features. Because the...
3
1663
by: Patrick McGuire | last post by:
I am instantiating several custom objects from a subset of data contained in an XML file. I then might edit these objects and save the changes back to the XML file. However, I want to compare the original state of the objects with the current object data stored in the XML file to alert the user to any changes that were made by other users during the time that the user was making his own edits. So I'm doing this:
5
3433
by: Dean Slindee | last post by:
I store several application settings in the project's "app.config" file. I also have a form that reads these values and displays them in a listview so that the user can adjust them. My question is: can the changes made by the user to the settings values be saved back to "app.config" so that when the application is launched tomorrow, the updated values are used? Since the original app.config settings are loaded to...
11
11563
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set object and displays the data correctly when I move from row to row. The problem I am having is the data set always reads the data back and considers it change even when it's not. I am looking for how to change the following code so the...
4
7815
by: ARC | last post by:
Hello all, I didn't use to have this problem in Access 97, but in 2007 (and maybe other versions of access after 97), if you have a form that has a subform, and you click the close button, you always get the following dialog: "Save changes to the following objects?" I tried putting a saverecord command prior to the close, but that had no affect. I have found a work around, but maybe I am making this too
2
1864
by: vibee | last post by:
fairly simple question but dont know how to do it...how do i prompt the user to ensure that the user wants to save changes made to an entry. thanks
0
8827
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...
0
8732
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
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
8606
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...
1
6169
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4159
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
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1622
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.