Public Function MsgBoxfByVal Prompt As Object. Optional ByVal .•('.':':'■:,'" As MicrQSQft.VisualBasic.MsqBoxStyle = OtOnly, Optional ByVal Title As Object = Nothing) As MicrQSQft.VisualBasic.MsqBoxResult
Member of MicrQSQft.VisualBasic.InteractiQn Summary:
Displays a message in a dialog box, warts for the user to dicta button, and then returns an integer indicating which button the user dieted.
Prompt1. Required. String expression displayed as the message in the dialog box. The maiximum length of Prompt is approximately 1024 characters, depending on the width of the characters used. If
Figure 2-26. The Microsoft.VisualBasic namespace contains the Interaction type.
As you will see in Chapter 3, a VB 2008 module is similar to a VB6 *.bas file, in that members defined within a module can be directly called without the need to prefix the name of the defining module. However, if you were to prefix the Interaction module to the MsgBox() function, the program would function identically:
Module Module1 Sub Main()
Interaction.MsgBox("Everything old is new again!") End Sub End Module
Now although it may feel a bit reassuring to know that the functionality of VB6 can still be simulated within new Visual Basic 2008 projects, I recommend that you avoid using these types where possible. First of all, the writing seems to be on the wall regarding the lifetime of VB6, in that Microsoft itself plans to phase out support for VB6 over time, and given this, you cannot guarantee that this compatibility assembly will be supported in the future.
As well, the base class libraries provide numerous managed types that offer much more functionality than the (soon-to-be) legacy VB6 programming language. Given these points, this text will not make use of the VB6 compatibility layer. Rather, you will focus on learning the .NET base class libraries and how to interact with these types using the syntax of Visual Basic 2008.
Was this article helpful?