HtmlWindow.Confirm メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As HtmlWindow Dim message As String Dim returnValue As Boolean returnValue = instance.Confirm(message)
戻り値
ユーザーが [はい] をクリックした場合は true。ユーザーが [No] をクリックしたか、ダイアログ ボックスを閉じた場合は false。

Confirm は、モーダル ダイアログ ボックスを表示します。ユーザーは、まずこのダイアログ ボックスを閉じない限り、その下に表示されている HTML ページにアクセスできません。
Confirm は Unicode テキストを入力として受け付けますが、Internet Explorer のスクリプト プロンプトでは、オペレーティング システムの制限により、Windows 95、Windows 98、Windows ME、Windows NT で、ラテン語以外のテキストが正しく表示されません。詳細については、「Internet Explorer のスクリプト プロンプトと MBCS/Unicode」(http://support.microsoft.com/default.aspx?scid=kb;ja-jp;211147) を参照してください。

次の HTML をコピーして、orderForm.htm という名前のフォームに保存します。
<HTML>
<BODY>
<OPTION>AZ-3700
<OPTION>AZ-3701
<OPTION>AZ-3702
Quantity: <INPUT type="text" name="PartQty" size="2" maxsize="2"><br>
Building/Desk:
<INPUT type="text" name="PartBuilding" size="2" maxsize="2"> /
<INPUT type="text" name="PartDesk" size="2" maxsize="2"><p>
<INPUT type="submit" value="Transmit Order">
</FORM>
</BODY>
</HTML>
ユーザーが NewOrderForm を送信したときに、Confirm を使用してダイアログ ボックスを表示するコード例を次に示します。
Dim OrderWindow As HtmlWindow Dim FormElement As HtmlElement Private Sub NewOrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewOrderButton.Click LoadOrderForm() End Sub Private Sub LoadOrderForm() If (Not WebBrowser1.Document Is Nothing) Then With WebBrowser1.Document OrderWindow = .Window.OpenNew(New Uri("file://C:\\orderForm.htm"), "") ' !TODO: Perform this in the load event handler! ' Get order form. Dim ElemCollection As System.Windows.Forms.HtmlElementCollection = .All.GetElementsByName("NewOrderForm") If (ElemCollection.Count = 1) Then FormElement = ElemCollection(0) ' TODO: Resolve this. 'FormElement.AttachEventHandler("onsubmit", New HtmlElementEventHandler(AddressOf Form_Submit)) End If End With End If End Sub Private Sub Form_Submit(ByVal sender As Object, ByVal e As HtmlElementEventArgs) Dim DoOrder As Boolean = OrderWindow.Confirm("Once you transmit this order, you cannot cancel it. Submit?") If (Not DoOrder) Then ' Cancel the submit. e.ReturnValue = False OrderWindow.Alert("Submit cancelled.") End If End Sub
HtmlWindow orderWindow; HtmlElement formElement; private void LoadOrderForm() { if (!(webBrowser1.Document == null)) { HtmlDocument doc = webBrowser1.Document; orderWindow = doc.Window.OpenNew(new Uri("file://C:\\orderForm.htm"), ""); //!TODO: Perform this in the load event handler! // Get order form. HtmlElementCollection elemCollection = doc.All.GetElementsByName("NewOrderForm"); if (elemCollection.Count == 1) { formElement = elemCollection[0]; //!TODO: Awaiting DCR //formElement.AttachEventHandler("onsubmit", new HtmlElementEventHandler(Form_Submit)); } } } private void Form_Submit(object sender, HtmlElementEventArgs e) { bool doOrder = orderWindow.Confirm("Once you transmit this order, you cannot cancel it. Submit?"); if (!doOrder) { //Cancel the submit. e.ReturnValue = false; orderWindow.Alert("Submit cancelled."); } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlWindow.Confirm メソッドを検索する場合は、下記のリンクをクリックしてください。

- HtmlWindow.Confirm メソッドのページへのリンク