6 Replies - 14660 Views - Last Post: 29 October 2009 - 08:23 PM Rate Topic: -----

#1 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

MsgBox with Yes No function

Posted 27 October 2009 - 08:43 AM

Hello, I want to make something like this: I have form1 and form2 and in form1 i have command1 and when I'll click it will show you msgbox with etc "text" YES NO? When I click Yes, it will show form2, but when I'll click NO, it will make the Command1 enabled = false. Can you please help me, how can I make somethink like this, i found some tutorials on net, but it didn't work. Thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: MsgBox with Yes No function

#2 Guest_evry1falls*


Reputation:

Re: MsgBox with Yes No function

Posted 27 October 2009 - 09:06 AM

Private Sub Command1_Click()
Dim Aa As String
Aa = MsgBox("are you sure u wanna show form2?", vbYesNo, "Question")
If Aa = vbYes Then
Form2.Show 1
Else
Command1.Enabled = 0
End If
End Sub

==========================================================================
There are many other ways to perform the previous action, but this is the (A B C) STEPS ..
take in mind that you may wanna have to repeat this action , you don't wanna write all of this everytime so you will need to learn about (Functions) ....
==========================================================================
Peace Man

This post has been edited by Core: 28 October 2009 - 11:00 AM

Was This Post Helpful? 1

#3 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

Re: MsgBox with Yes No function

Posted 27 October 2009 - 12:21 PM

Thank you very much, evry1falls.
Was This Post Helpful? 0
  • +
  • -

#4 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: MsgBox with Yes No function

Posted 27 October 2009 - 08:07 PM

Although, let me note that the variable Aa should be declared as an integer and not a string as vbyes = 6 and vbno = 7, integer values.



Good Luck
Was This Post Helpful? 0
  • +
  • -

#5 Guest_evry1falls*


Reputation:

Re: MsgBox with Yes No function

Posted 29 October 2009 - 11:49 AM

In the name of ALLAH the most Gracious , The Most Merciful

Hello vb5prgrmr .

i don't much difference, it works fine this way with me ...

but could you please explain more your theory ?? coz i don't get what you say !!
Was This Post Helpful? 0

#6 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: MsgBox with Yes No function

Posted 29 October 2009 - 12:46 PM

his point is that vbYes is of type integer = 6 that is why it is better to declare "Dim Aa As String" As Integer type but because vb6 compiler convert string to integer on it self is possible to run this program. How ever it is recommended that you use Integer type of your result returning variable :) ("Dim Aa As Integer")

This post has been edited by NoBrain: 29 October 2009 - 12:47 PM

Was This Post Helpful? 0
  • +
  • -

#7 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: MsgBox with Yes No function

Posted 29 October 2009 - 08:23 PM

In the name of what fictional character???

Thanks NoBrain for explaining that...

This post has been edited by vb5prgrmr: 29 October 2009 - 08:23 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1