public static string InputBox(string Prompt, string Title = "", string DefaultResponse = "", int XPos = -1, int YPos = -1)
        {
            IWin32Window parentWindow = null;
            IVbHost      vBHost       = HostServices.VBHost;

            if (vBHost != null)
            {
                parentWindow = vBHost.GetParentWindow();
            }
            if (Title.Length == 0)
            {
                if (vBHost == null)
                {
                    Title = GetTitleFromAssembly(Assembly.GetCallingAssembly());
                }
                else
                {
                    Title = vBHost.GetWindowTitle();
                }
            }
            if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
            {
                return(InternalInputBox(Prompt, Title, DefaultResponse, XPos, YPos, parentWindow));
            }
            InputBoxHandler handler = new InputBoxHandler(Prompt, Title, DefaultResponse, XPos, YPos, parentWindow);
            Thread          thread  = new Thread(new ThreadStart(handler.StartHere));

            thread.Start();
            thread.Join();
            if (handler.Exception != null)
            {
                throw handler.Exception;
            }
            return(handler.Result);
        }
        public void Raise(int Number, object Source = null, object Description = null, object HelpFile = null, object HelpContext = null)
        {
            if (Number == 0)
            {
                throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Number" }));
            }
            this.Number = Number;
            if (Source != null)
            {
                this.Source = Conversions.ToString(Source);
            }
            else
            {
                IVbHost vBHost = HostServices.VBHost;
                if (vBHost == null)
                {
                    string fullName = Assembly.GetCallingAssembly().FullName;
                    int    num      = Strings.InStr(fullName, ",", CompareMethod.Binary);
                    if (num < 1)
                    {
                        this.Source = fullName;
                    }
                    else
                    {
                        this.Source = Strings.Left(fullName, num - 1);
                    }
                }
                else
                {
                    this.Source = vBHost.GetWindowTitle();
                }
            }
            if (HelpFile != null)
            {
                this.HelpFile = Conversions.ToString(HelpFile);
            }
            if (HelpContext != null)
            {
                this.HelpContext = Conversions.ToInteger(HelpContext);
            }
            if (Description != null)
            {
                this.Description = Conversions.ToString(Description);
            }
            else if (!this.m_DescriptionIsSet)
            {
                this.Description = Utils.GetResourceString((vbErrors)this.m_curNumber);
            }
            Exception exception = this.MapNumberToException(this.m_curNumber, this.m_curDescription);

            exception.Source      = this.m_curSource;
            exception.HelpLink    = this.MakeHelpLink(this.m_curHelpFile, this.m_curHelpContext);
            this.m_ClearOnCapture = false;
            throw exception;
        }
        public static MsgBoxResult MsgBox(object Prompt, MsgBoxStyle Buttons = 0, object Title = null)
        {
            IWin32Window owner = null;
            string       text  = null;
            string       titleFromAssembly;
            IVbHost      vBHost = HostServices.VBHost;

            if (vBHost != null)
            {
                owner = vBHost.GetParentWindow();
            }
            if ((((Buttons & 15) > MsgBoxStyle.RetryCancel) || ((Buttons & 240) > MsgBoxStyle.Information)) || ((Buttons & 0xf00) > MsgBoxStyle.DefaultButton3))
            {
                Buttons = MsgBoxStyle.ApplicationModal;
            }
            try
            {
                if (Prompt != null)
                {
                    text = (string)Conversions.ChangeType(Prompt, typeof(string));
                }
            }
            catch (StackOverflowException exception)
            {
                throw exception;
            }
            catch (OutOfMemoryException exception2)
            {
                throw exception2;
            }
            catch (ThreadAbortException exception3)
            {
                throw exception3;
            }
            catch (Exception)
            {
                throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValueType2", new string[] { "Prompt", "String" }));
            }
            try
            {
                if (Title == null)
                {
                    if (vBHost == null)
                    {
                        titleFromAssembly = GetTitleFromAssembly(Assembly.GetCallingAssembly());
                    }
                    else
                    {
                        titleFromAssembly = vBHost.GetWindowTitle();
                    }
                }
                else
                {
                    titleFromAssembly = Conversions.ToString(Title);
                }
            }
            catch (StackOverflowException exception4)
            {
                throw exception4;
            }
            catch (OutOfMemoryException exception5)
            {
                throw exception5;
            }
            catch (ThreadAbortException exception6)
            {
                throw exception6;
            }
            catch (Exception)
            {
                throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValueType2", new string[] { "Title", "String" }));
            }
            return((MsgBoxResult)MessageBox.Show(owner, text, titleFromAssembly, ((MessageBoxButtons)Buttons) & ((MessageBoxButtons)15), ((MessageBoxIcon)Buttons) & ((MessageBoxIcon)240), ((MessageBoxDefaultButton)Buttons) & ((MessageBoxDefaultButton)0xf00), ((MessageBoxOptions)Buttons) & ((MessageBoxOptions)(-4096))));
        }