User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 425,979 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,613 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 621 | Replies: 6
Reply
Join Date: Apr 2008
Posts: 19
Reputation: mansi sharma is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
mansi sharma mansi sharma is offline Offline
Newbie Poster

Dialog Box

  #1  
Apr 5th, 2008
Private Sub Command2_Click()
MsgBox "Have a gala shopping", vbOKCancel, "welcome to the superMarket"
End Sub

Hey, 1) I want to know how to add icons in the message Box .
2) How To Set the Default Button.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 34
Reputation: techtix is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
techtix techtix is offline Offline
Light Poster

Re: Dialog Box

  #2  
Apr 5th, 2008
MsgBox is a function with a return parameter available. The syntax is as follows:

ReturnVal = MsgBox(Prompt, Options, Title)

Options is a combination of your buttons, icons, and default button.

Example: ReturnVal = MsgBox("Do you want to continue?", VBYesNo + VBQuestion + VBDefaultButton1, "Closing")

The allowable values are listed on the Microsoft MSDN Library web site
http://msdn2.microsoft.com/en-us/lib...82(VS.60).aspx
Reply With Quote  
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,584
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Rep Power: 11
Solved Threads: 235
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Dialog Box

  #3  
Apr 5th, 2008
to set default button u don't have to fill button style in msgbox or use vbdefaultbutton style.
ex : msgbox("message","Titile") -> it will shown Ok only.
to get other icon do like techtix said.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Join Date: Mar 2008
Posts: 119
Reputation: sonia sardana is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
sonia sardana sonia sardana is offline Offline
Junior Poster

Re: Dialog Box

  #4  
Apr 5th, 2008
.
Last edited by sonia sardana : Apr 5th, 2008 at 11:42 pm.
Reply With Quote  
Join Date: Apr 2008
Posts: 34
Reputation: techtix is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
techtix techtix is offline Offline
Light Poster

Re: Dialog Box

  #5  
Apr 5th, 2008
When calling a function, make sure you use parentheses. Also, you are not soliciting a vbYes from the user. Just a vbOK or vbCancel.

** It's a personal preference, but when I call a function that is overloaded as a method, I try to always still call it as a function.

Private Sub Command2_Click()
Dim iResponse As Integer

iResponse = MsgBox("Have a gala shopping", vbOKCancel + vbInformation + vbDefaultButton1, "welcome to the superMarket")

If iResponse = vbOK Then
     Call MsgBox("sonia")
End If

End Sub
Last edited by techtix : Apr 5th, 2008 at 11:47 pm.
Reply With Quote  
Join Date: Apr 2008
Posts: 19
Reputation: mansi sharma is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
mansi sharma mansi sharma is offline Offline
Newbie Poster

Re: Dialog Box

  #6  
Apr 5th, 2008
Private Sub Command2_Click()
Dim response As Integer

Response=MsgBox "Have a gala shopping", vbOKCancel + vbInformation + vbDefaultButton1, "welcome to the superMarket"

If response = vbYes Then
MsgBox "mansi"
End If
End Sub

I want to display the further msg on Yes button ,But the error is the response.

Jx_man,Ya dats right,by default first button in the dialog Box is the default button, But if there are two buttons, & to set the second button as default button, we have to follow the texttix code...
Reply With Quote  
Join Date: Apr 2008
Posts: 34
Reputation: techtix is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
techtix techtix is offline Offline
Light Poster

Re: Dialog Box

  #7  
Apr 5th, 2008
Still a problem here. The MsgBox options you are setting are vbOkCancel. This will never return a vbYes. Your only options for a return code are vbOk and vbCancel.

** See my previous post for the correct code.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 11:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC