3 Replies - 297 Views - Last Post: 26 December 2011 - 01:34 PM Rate Topic: -----

#1 CodyWD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 21-February 10

Why doesn't this code work?

Posted 26 December 2011 - 01:25 PM

If newFileText > Me.ProductVersion Then
                If MessageBox.Show("There is a New Version Available. Version " + newFileText + " is currently available. Do you wish to download?", "New Version!", MessageBoxButtons.YesNo) And DialogResult.Yes Then
                    MessageBox.Show("Yes")
                Else
                    MessageBox.Show("No")
                End If
            Else
                    MessageBox.Show("There is no new version avilable. You currently have " + Me.ProductVersion + " and that is the latest version.", "No New Version.")
            End If



It acts as if Yes is clicked either way?

Is This A Good Question/Topic? 0
  • +

Replies To: Why doesn't this code work?

#2 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Why doesn't this code work?

Posted 26 December 2011 - 01:31 PM

Well an example would be
If MsgBox("bleairgh", MsgBoxStyle.YesNoCancel, "Update") = vbYes Then
MsgBox("yes")
Else
MsgBox("no")


I'm not sure why, but the code you gave isn't wrapping properly and is going off the side of my screen so I can't see it all. So if this isn't the case then sorry!
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9568
  • View blog
  • Posts: 36,222
  • Joined: 12-June 08

Re: Why doesn't this code work?

Posted 26 December 2011 - 01:32 PM

Are you trying to have the if statement evaluate the message box's return as a dialogresult.yes? If so perhaps use the boolean comparison of "=" instead of "and".
Was This Post Helpful? 0
  • +
  • -

#4 CodyWD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 21-February 10

Re: Why doesn't this code work?

Posted 26 December 2011 - 01:34 PM

Thanks both of you! :) It works now haha. Thought and would do roughly same thing as equals. I was obviously wrong xD
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1