   What does this mean? (VB.net)
  This code:'display the messagebox dialog and capture the DialogResult returned...intResult = MessageBox.Show(txtMessage.Text, txtCaption.Text, intButton, _  intIcon, intDefaultButton)Get's this message:Overload resolution failed because no accessible 'Show' can be called without a narrowing conversion:    'Public Shared Function Show(owner As System.Windows.Forms.IWin32Window, text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon) As System.Windows.Forms.DialogResult': Argument matching parameter 'owner' narrows from 'String' to 'System.Windows.Forms.IWin32Window'.    'Public Shared Function Show(owner As System.Windows.Forms.IWin32Window, text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon) As System.Windows.Forms.DialogResult': Argument matching parameter 'caption' narrows from 'Integer' to 'String'.    'Public Shared Function Show(owner As System.Windows.Forms.IWin32Window, text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon) As System.Windows.Forms.DialogResult': Argument matching parameter 'buttons' narrows from 'Integer' to 'System.Windows.Forms.MessageBoxButtons'.    'Public Shared Function Show(owner As System.Windows.Forms.IWin32Window, text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon) As System.Windows.Forms.DialogResult': Argument matching parameter 'icon' narrows from 'Integer' to 'System.Windows.Forms.MessageBoxIcon'.    'Public Shared Function Show(text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon, defaultButton As System.Windows.Forms.MessageBoxDefaultButton) As System.Windows.Forms.DialogResult': Argument matching parameter 'buttons' narrows from 'Integer' to 'System.Windows.Forms.MessageBoxButtons'.    'Public Shared Function Show(text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon, defaultButton As System.Windows.Forms.MessageBoxDefaultButton) As System.Windows.Forms.DialogResult': Argument matching parameter 'icon' narrows from 'Integer' to 'System.Windows.Forms.MessageBoxIcon'.    'Public Shared Function Show(text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon, defaultButton As System.Windows.Forms.MessageBoxDefaultButton) As System.Windows.Forms.DialogResult': Argument matching parameter 'defaultButton' narrows from 'Integer' to 'System.Windows.Forms.MessageBoxDefaultButton'.What does this mean? To me it's just '??'.   
  Two things come to mind.  First, what values are held in the intButton, intIcon, and intDefaultButton variables?  If they are real ints then they need to be casted to the correct type or just use the actual values(ie. MessageBoxButtons.OK).  The other thing is that MSDN says this function is new in .NET 2.0 so if you're using 1.1 then it won't work.  Based on the error messages, though, I'd say it's the first one, so give that a try and see what happens.  Hope this helps.-AJ   ;  Okay, the entire code looks like this (copied from a book):Public Class frmMessageBox    Public Sub New()   MyBase.New()   ' This call is required by the Windows Form Designer.   InitializeComponent()   ' Add any initialization after the InitializeComponent() call.   'add event handlers for icon radio buttons...   AddHandler rdbAsterisk.Click, AddressOf Icon_Click   AddHandler rdbError.Click, AddressOf Icon_Click   AddHandler rdbExclamation.Click, AddressOf Icon_Click   AddHandler rdbHand.Click, AddressOf Icon_Click   AddHandler rdbInformation.Click, AddressOf Icon_Click   AddHandler rdbQuestion.Click, AddressOf Icon_Click   AddHandler rdbStop.Click, AddressOf Icon_Click   AddHandler rdbWarning.Click, AddressOf Icon_Click   'add event handlers for button radio buttons...   AddHandler rdbAbortRetryIgnore.Click, AddressOf Icon_Click   AddHandler rdbOK.Click, AddressOf Icon_Click   AddHandler rdbOKCancel.Click, AddressOf Icon_Click   AddHandler rdbRetryCancel.Click, AddressOf Icon_Click   AddHandler rdbYesNo.Click, AddressOf Icon_Click   AddHandler rdbYesNoCancel.Click, AddressOf Icon_Click   'add event handler for defaultbutton radio buttons...   AddHandler rdbDefaultButton1.Click, AddressOf Icon_Click   AddHandler rdbDefaultButton2.Click, AddressOf Icon_Click   AddHandler rdbDefaultButton3.Click, AddressOf Icon_Click    End Sub    'Declare variables...    Private intIcon As Integer = MessageBoxIcon.Asterisk, _    intButton As Integer = MessageBoxButtons.OKCancel, _    intDefaultButton As Integer = MessageBoxDefaultButton.Button1    Private Sub Icon_Click(ByVal sender As Object, ByVal e As System.EventArgs)   'select the icon radio button that we checked and set the intIcon variable...   Select Case sender.Name  Case "rdbAsterisk" intIcon = MessageBoxIcon.Asterisk  Case "rdbError" intIcon = MessageBoxIcon.Error  Case "rdbExclamation" intIcon = MessageBoxIcon.Exclamation  Case "rdbHand" intIcon = MessageBoxIcon.Hand  Case "rdbInformation" intIcon = MessageBoxIcon.Information  Case "rdbQuestion" intIcon = MessageBoxIcon.Question  Case "rdbStop" intIcon = MessageBoxIcon.Stop  Case "rdbWarning" intIcon = MessageBoxIcon.Warning   End Select    End Sub    Private Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs)   'select the radio button that was checked and set the intButton variable...   Select Case sender.Name  Case "rdbAbortRetryIgnore" intButton = MessageBoxButtons.AbortRetryIgnore  Case "rdbOK" intButton = MessageBoxButtons.OK  Case "rdbOKCancel" intButton = MessageBoxButtons.OKCancel  Case "rdbRetryCancel" intButton = MessageBoxButtons.RetryCancel  Case "rdbYesNo" intButton = MessageBoxButtons.YesNo  Case "rdbYesNoCancel" intButton = MessageBoxButtons.YesNoCancel   End Select    End Sub    Private Sub DefaultButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)   'select the defaultbutton radio button that was checked and set the intDefaultButton variable...   Select Case sender.Name  Case "rdbDefaultButton1" intButton = MessageBoxDefaultButton.Button1  Case "rdbDefaultButton2" intButton = MessageBoxDefaultButton.Button2  Case "rdbDefaultButton3" intButton = MessageBoxDefaultButton.Button3   End Select    End Sub    Private Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShow.Click   'declare variable for DialogResult...   Dim intResult As Integer   'display the messagebox dialog and capture the DialogResult returned...   intResult = MessageBox.Show(txtMessage.Text, txtCaption.Text, intButton, _intIcon, intDefaultButton)   'select the apropriate result returned and display a message...   Select Case intResult  Case DialogResult.Abort txtResult.Text = "Abort Clicked"  Case DialogResult.Retry txtResult.Text = "Retry Clicked"  Case DialogResult.Ignore txtResult.Text = "Ignore Clicked"  Case DialogResult.OK txtResult.Text = "OK Clicked"  Case DialogResult.Cancel txtResult.Text = "Cancel Clicked"  Case DialogResult.Yes txtResult.Text = "Yes Clicked"  Case DialogResult.No txtResult.Text = "No Clicked"   End Select    End SubEnd ClassI wrote this code in VS 2005, so I guess it uses .NET 2.0 ;)   ;  So intButton, intIcon, and intDefaultButton are all Integers?  I haven't done a whole lot in VB.NET, but I know in C# if you do something like that, you need to cast the Integers to the appropriate enum type.  Also, regarding the errors on the strings for the message and caption, I don't know why, but it looks like the compiler is treating them as Integers.  Try passing CStr(txtMessage.Text) and CStr(txtCaption.Text) instead.  I an assuming that textMessage and txtCaption are textboxes on your form.  Hope that helps.-AJ   ;  At most VB would throw up a warning but it would allow it since they're enums, not really types, and enums are by default integers anyways.You didn't accidentally make something else named messagebox did you?What about writing a normal call without variable based parameters above the erroring code as a test?   ;  After writing that I realized, I bet one of the enums isn't an integer. Change your variables to the explicit types that the MessageBox.Show functiohn asks for instead of generic integers.   ;Quote:Original post by u235So intButton, intIcon, and intDefaultButton are all Integers?  I haven't done a whole lot in VB.NET, but I know in C# if you do something like that, you need to cast the Integers to the appropriate enum type.  Also, regarding the errors on the strings for the message and caption, I don't know why, but it looks like the compiler is treating them as Integers.  Try passing CStr(txtMessage.Text) and CStr(txtCaption.Text) instead.  I an assuming that textMessage and txtCaption are textboxes on your form.  Hope that helps.-AJThat didn't work, CStr is aparantly not a valid expression in VB.net... :/   ;Quote:Original post by ZyndrofQuote:Original post by u235So intButton, intIcon, and intDefaultButton are all Integers?  I haven't done a whole lot in VB.NET, but I know in C# if you do something like that, you need to cast the Integers to the appropriate enum type.  Also, regarding the errors on the strings for the message and caption, I don't know why, but it looks like the compiler is treating them as Integers.  Try passing CStr(txtMessage.Text) and CStr(txtCaption.Text) instead.  I an assuming that textMessage and txtCaption are textboxes on your form.  Hope that helps.-AJThat didn't work, CStr is aparantly not a valid expression in VB.net... :/It should work.  I've used it before in VB .NET projects with no trouble.  Are those the only errors you're getting now, the ones regarding the strings?-AJ   ;Quote:Original post by u235It should work.  I've used it before in VB .NET projects with no trouble.  Are those the only errors you're getting now, the ones regarding the strings?-AJNope, the old error's still there.;  Well, I'm all out of ideas, then, sorry.  But I will try your code out when I get back to my computer at home and see if I can't figure out what's going on.-AJ   