message box code

message box NO not executing

Page 1 of 1

4 Replies - 4068 Views - Last Post: 21 December 2010 - 05:46 AM Rate Topic: -----

#1 kadiaReid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 24-April 10

message box code

Posted 18 December 2010 - 04:06 PM

yes/no message box used but No response does not execute properly and gives the same response as Yes selection.
If AdultCanoeing.Value < 1 Then 'And AdultTennis.Value And AdultWaterSkiing.Value And AdultWindSurfing.Value < 1 Then
            MsgBox(" No Extras selected,Do you want Extras", MsgBoxStyle.YesNo)
            If MsgBoxResult.Yes Then Form1.Visible = True
        Else ' MsgBoxResult.No Then

            MsgBox("proceed to next page")

        End If



Is This A Good Question/Topic? 0
  • +

Replies To: message box code

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: message box code

Posted 18 December 2010 - 04:09 PM

kadiaReid, PLEASE STOP posting VB.NET code in the VB6 forum! Your code is VB.NET, NOT VB6!!! Post in the VB.NET Forum.

Moved to VB.NET.
Was This Post Helpful? 0
  • +
  • -

#3 kadiaReid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 24-April 10

Re: message box code

Posted 18 December 2010 - 04:11 PM

I'm very sorry, saw your post after posting this one. any help please
Was This Post Helpful? 0
  • +
  • -

#4 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2264
  • View blog
  • Posts: 9,469
  • Joined: 29-May 08

Re: message box code

Posted 18 December 2010 - 04:55 PM

View PostFrom 18 December 2010 - 11:06 PM:

yes/no message box used but No response does not execute properly and gives the same response as Yes selection.
If AdultCanoeing.Value < 1 Then 'And AdultTennis.Value And AdultWaterSkiing.Value And AdultWindSurfing.Value < 1 Then
            MsgBox(" No Extras selected,Do you want Extras", MsgBoxStyle.YesNo)
            If MsgBoxResult.Yes Then Form1.Visible = True
        Else ' MsgBoxResult.No Then

            MsgBox("proceed to next page")

        End If



kadiaReid:
1. The symbol ' indicates that what follows to the end of the line is a commment.
2. If don't store the resultant reply of the messagebox, you can't then write code based on it reply. Eg
MsgBox(" No Extras selected,Do you want Extras", MsgBoxStyle.YesNo)
If MsgBoxResult.No Then 
 ' do stuff based on an reply of No 
End If


Use MessageBox instead and DialogResult
  Dim reply As DialogResult = MessageBox.Show(" No Extras selected,Do you want Extras", "", MessageBoxButtons.YesNo)
    If reply = DialogResult.No Then
      ' do stuff based on a reply of No
    End If



Was This Post Helpful? 0
  • +
  • -

#5 kadiaReid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 24-April 10

Re: message box code

Posted 21 December 2010 - 05:46 AM

Thanks for your help well appreciated.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1