Custom Message Box

Reply

Join Date: Feb 2007
Posts: 1
Reputation: imrankhalidtoor is an unknown quantity at this point 
Solved Threads: 0
imrankhalidtoor imrankhalidtoor is offline Offline
Newbie Poster

Custom Message Box

 
0
  #1
Feb 16th, 2007
hi
I want to make a custom message box alert just like VB6 built-in "VBOKCancel"....In that custom message box alert, i want the functionality of "VBOKCancel" as well as an additional button and check boxes.....much appreciated if anybody helps me out.

Thanx
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 917
Reputation: linux is an unknown quantity at this point 
Solved Threads: 27
linux's Avatar
linux linux is offline Offline
Posting Shark

Re: Custom Message Box

 
0
  #2
Feb 24th, 2007
Err... Why don't you just make a new form (frmMsgBox)?

You can just do something like:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. frmMsgBox!Text1 = "Testing, 1,2,3"
  2. Load frmMsgBox
  3. frmMsgBox.Show

You can change frmMsgBox!Text1 = "" to whatever you want the message to say. You can add buttons, an icon, etc to it.

Does that work?
Toshiba M1151.49 GB DDR-2 RAM1.6 GHz Centrino Duo80GB HDDWindows XP Media Center Edition
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 20
Reputation: AycheKay is an unknown quantity at this point 
Solved Threads: 0
AycheKay AycheKay is offline Offline
Newbie Poster

Re: Custom Message Box

 
0
  #3
Mar 3rd, 2007
I did exactly what you are talking about doing and made it an ActiveX dll using VB6. This is a message box with four large buttons. When you call the message box, you pass in the title for the message box window and you also pass in at least one string value for the button captions, and up to four string values to cover all the button captions. This function will then pass the value back that was pressed.

I'm using one class module and one form module. Here's the code I'm using:

cMsgBoxes Class Module Code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2.  
  3. Public Function MsgBox4Button(strTitle As String, strcmd1 As String, Optional strcmd2 As String = " ", Optional strcmd3 As String = " ", Optional strcmd4 As String = " ") As String
  4.  
  5. With frmMsgBox4Button
  6. .Caption = strTitle
  7. .cmd1.Caption = strcmd1
  8. .cmd2.Caption = strcmd2
  9. .cmd3.Caption = strcmd3
  10. .cmd4.Caption = strcmd4
  11. If Trim(.cmd2.Caption) = "" Then .cmd2.Visible = False
  12. If Trim(.cmd3.Caption) = "" Then .cmd3.Visible = False
  13. If Trim(.cmd4.Caption) = "" Then .cmd4.Visible = False
  14. End With
  15.  
  16. frmMsgBox4Button.Show 1
  17. MsgBox4Button = frmMsgBox4Button.Response
  18. Unload frmMsgBox4Button
  19.  
  20. End Function



frmMsgBox4Button Form Module Code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2.  
  3. Public Response As String
  4.  
  5. Private Sub cmd1_Click()
  6. Response = cmd1.Caption
  7. Me.Hide
  8. End Sub
  9.  
  10. Private Sub cmd2_Click()
  11. Response = cmd2.Caption
  12. Me.Hide
  13. End Sub
  14.  
  15. Private Sub cmd3_Click()
  16. Response = cmd3.Caption
  17. Me.Hide
  18. End Sub
  19.  
  20. Private Sub cmd4_Click()
  21. Response = cmd4.Caption
  22. Me.Hide
  23. End Sub



Here's how I'm using this dll. I just keep it in the directory of my .exe or my VBScript file. No need to register this dll if you do that. I've compiled the project with the project name "MsgBoxes" and named the dll "MsgBoxes.dll". In my code I use late binding:

VBScript:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim objMsgBox, MyMsgBox
  2.  
  3. Set objMsgBox = CreateObject("MsgBoxes.cMsgBoxes")
  4. MyMsgBox = objMsgBox.MsgBox4Button("What would you like to do?", "Go to work.", "Go Home.", "Go hang.")
  5. MsgBox MyMsgBox
  6.  
  7. Set objMsgBox = Nothing
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: Custom Message Box

 
0
  #4
Mar 3rd, 2007
Why use Active-X? Just define a form, it's straight forward and simple.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 20
Reputation: AycheKay is an unknown quantity at this point 
Solved Threads: 0
AycheKay AycheKay is offline Offline
Newbie Poster

Re: Custom Message Box

 
0
  #5
Mar 3rd, 2007
My ActiveX dll can be used by VBScript. That was my whole point in making it an ActiveX dll. Really, it can be called from most any language.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: Custom Message Box

 
0
  #6
Mar 4th, 2007
Since he hasn't been back since he posted this request, I guess it doesn't really matter how cool or how easy a method is. He's just wasted our time...
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 1
Reputation: fatmafarfesh is an unknown quantity at this point 
Solved Threads: 0
fatmafarfesh fatmafarfesh is offline Offline
Newbie Poster
 
0
  #7
Jan 29th, 2008
i make a program with vb, this program about making a store .
i have a simple problem with this program
want to make a message box that can ok and cancelthat connect with a database to show some records from a tabel as sequential.
but i cannot make this button do its functions to be ok or cancel
can any one help me
this is the code of button that show the records:
Private Sub Command1_Click()
Dim conConnection As New ADODB.Connection
Dim cmdCommand As New ADODB.Command
Dim rstRecordSet As New ADODB.Recordset
Dim urmsg As Integer
conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\" & "min requirements.mdb;Mode=Read|Write"
conConnection.CursorLocation = adUseClient
conConnection.Open

With cmdCommand
.ActiveConnection = conConnection
.CommandText = "SELECT * FROM dealers;"
.CommandType = adCmdText

End With

With rstRecordSet
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open cmdCommand
End With

If rstRecordSet.EOF = False Then
rstRecordSet.MoveFirst
Do

urmsg = MsgBox("ÈíÇäÇÊ ÇáÓÌá" & rstRecordSet.AbsolutePosition & " " & _
rstRecordSet.Fields(0).Name & "=" & rstRecordSet.Fields(0) & " " & _
rstRecordSet.Fields(1).Name & "=" & rstRecordSet.Fields(1) & " " & _
rstRecordSet.Fields(2).Name & "=" & rstRecordSet.Fields(2) & " " & _
rstRecordSet.Fields(3).Name & "=" & rstRecordSet.Fields(3), vbOKCancel, "ÚÑÖ ÇáÚãáÇÁ")
rstRecordSet.MoveNext
Loop Until rstRecordSet.EOF = True
Select Case urmsg
Case 6 'If the user clicks "Yes" then...
rstRecordSet.MoveNext 'Quit the program
Case 7 'If the user click on No....
Exit Sub 'Then Exit the sub, not the program.
End Select
'With rstRecordSet
' .AddNew
' .Fields(0) = "New"
' .Fields(1) = "Record"
' .Update
'End With
'rstRecordSet.MoveFirst
'rstRecordSet.Delete
'rstRecordSet.Update
'rstRecordSet.Close
Else
MsgBox "Nn records were returned ushng the query " & cmdCommand.CommandText
End If
conConnection.Close
Set conConnection = Nothing
Set cmdCommand = Nothing
Set rstRecordSet = Nothing
End Sub
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: Custom Message Box

 
0
  #8
Jun 22nd, 2009
i just want to customize regular messagebox sound, is that possible?
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 826
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 150
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Custom Message Box

 
0
  #9
Jun 22nd, 2009
serkan sendur,

Please start your own thread

No. You will have to make your own form that looks like a message box.

Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC