Jump to content

Android

Потребител
  • Брой теми

    2
  • Регистрация

  • Последно посещение

Android's Achievements

Новобранец

Новобранец (1/14)

0

Репутация в общността

  1. Public Class Form1 Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason = CloseReason.UserClosing Then Dim NeedsSave As Boolean = False 'Perform contextual validations here and (re)set NeedsSave accordingly... NeedsSave = True '<-- Testing value. If NeedsSave Then Dim result As DialogResult = MessageBox.Show("You have some unsaved changes. " _ & "Do you want to save them now?", "Unsaved Changes", MessageBoxButtons.YesNoCancel, _ MessageBoxIcon.Information) Select Case result Case Windows.Forms.DialogResult.Cancel 'Cancel the form closing. e.Cancel = True Return Case Windows.Forms.DialogResult.Yes If SaveChanges() = False Then 'The user should still be able to cancel out here so 'that hanges are not lost (as long as the user can 'perform the changes. If MessageBox.Show("The save failed. Do you still want close?", _ "Save Failed", MessageBoxButtons.OKCancel) = Windows.Forms.DialogResult.Cancel Then e.Cancel = True Return Else 'Allow the form to close. End If End If Case Else 'Allow the form to close. End Select End If End If End Sub Private Function SaveChanges() As Boolean 'Place save algorithm here... 'True = success, False means the save failed. Return False '<--For testing. End Function End Class Ето на някой ако му трябва в случай, че има желание да си го направи да го пита дали иска да се запазват промените преди изход от програмата.
  2. Здравейте! Тук съм за да попитам нещо, което ми привлече вниманието, но не можах да го направя, та... Въпроса ми е следния, как да направя така, че при натискане на хикса за изход от програмата да те пита дали си съгласен да я напуснеш с "Yes/No" question? Ако на някой му се занимава, нека ми опише малко по-подробно как да постигна този ефект, благодаря.
×
×
  • Създай ново...