editor

  • VB.NET

Es gibt 5 Antworten in diesem Thema. Der letzte Beitrag () ist von underground77.

    habe mal eine kleine frage , jeder kennt es zb. bei word wenn man auf den close button geht dann kommt meist noch eine meldung möchten sie das Projekt speichern oder so

    so will ich das in mein editor auch machen nur mmm wollte das ganze so lösen

    VB.NET-Quellcode

    1. Private Sub UserImport_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
    2. If MsgBox("Text Speichern ?", MsgBoxStyle.YesNo, "Frage") = MsgBoxResult.Yes Then
    3. Else
    4. End If
    5. End Sub


    fragen tut er aber wie sag ich ihm am besten das er wenn ich auf yes klicke also auf ja die textdatei abspeichern soll auch per if ?

    bitte helft xdd


    Mit freundlichen Gruß
    Hi..

    Schau dir das mal an:

    VB.NET-Quellcode

    1. Dim msg As String
    2. Dim title As String
    3. Dim style As MsgBoxStyle
    4. Dim response As MsgBoxResult
    5. msg = "Do you want to continue?" ' Define message.
    6. style = MsgBoxStyle.DefaultButton2 Or _
    7. MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
    8. title = "MsgBox Demonstration" ' Define title.
    9. ' Display message.
    10. response = MsgBox(msg, style, title)
    11. If response = MsgBoxResult.Yes Then ' User chose Yes.
    12. ' Perform some action.
    13. Else
    14. ' Perform some other action.
    15. End If


    Mehr dazu findest du hier

    MFG Andi2572
    danke ersteinmal aber ich habe das jetz schon soweit mit abbspeichern selbst raus gefunden und so nur noch eine kleine frage


    VB.NET-Quellcode

    1. Dim msg As String
    2. Dim title As String
    3. Dim style As MsgBoxStyle
    4. Dim response As MsgBoxResult
    5. msg = "Do you want to continue?" ' Define message.
    6. style = MsgBoxStyle.DefaultButton2 Or _
    7. MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
    8. title = "MsgBox Demonstration" ' Define title.
    9. ' Display message.
    10. response = MsgBox(msg, style, title)
    11. If response = MsgBoxResult.Yes Then ' User chose Yes.
    12. End
    13. Else
    14. ' wie sage ich ihm hier am besten das er die form dann nicht schlie?en soll ?
    15. End If


    die frage ist im source ^^
    Bitte lasst die veraltete MsgBox-Funktion in Ruhe, sonst bricht hier wieder eine Diskussion aus.

    VB.NET-Quellcode

    1. Private Sub Form1_FormClosing(sender As Object, _
    2. e As System.Windows.Forms.FormClosingEventArgs) _
    3. Handles Me.FormClosing
    4. Select Case MessageBox.Show("Der Text wurde noch nicht gespeichert. Willst du bla bla bla...?",_
    5. "Speichern?", MessageBoxButtons.YesNoCancel)
    6. Case Windows.Forms.DialogResult.Yes
    7. 'Hier dein Code für Datei speichern
    8. MsgBox("speichern")
    9. Case Windows.Forms.DialogResult.No
    10. Case Windows.Forms.DialogResult.Cancel
    11. e.Cancel = True
    12. 'Beenden wird abgebrochen
    13. End Select
    14. End Sub