(I like adams approach and comments...)
Otherwise, you could just restructure it a bit?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If MessageBox.Show("Blah Blah One.", "", MessageBoxButtons.OKCancel
If MessageBox.Show("Blah Blah Two.", "", MessageBoxButtons.OKCancel
If MessageBox.Show("Blah Blah Three.", "", MessageBoxButtons.OKCancel
If MessageBox.Show("Blah Blah Four.", "", MessageBoxButtons.OKCancel
' All selections were "OK"
End If
End If
End If
End If
MessageBox.Show("The End")
End Sub
Not that much of an improvement though!
Main Topics
Browse All Topics





by: adam_pedleyPosted on 2007-10-21 at 20:03:49ID: 20120542
Well this way is going to add more code but is easier to read, im not sure if there is an easier way to do this
) = Windows.Forms.DialogResult .Cancel) then
Public Sub Load()
Dim messages() As String = New String() {"Message1", "Message2"}
For Each msg As String In messages
If Not DisplayMessage(msg) Then
Exit For
End If
Next
End Sub
Public Function DisplayMessage(ByVal message As String) As Boolean
If MessageBox.Show(message, "", MessageBoxButtons.OKCancel
Return False
Else : Return True
End If
End Function
But before you implement that I would consider revising your GUI, as an application that performs 5 checks before proceeding will be quite annoying for users
Maybe checkboxes that need to be checked before the continue button is enabled?