ValidationConstraints 列挙体とは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ValidationConstraints 列挙体の意味・解説 

ValidationConstraints 列挙体

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

コンテナの子コントロール検証方法を ValidateChildren に通知する定数定義します

この列挙体には、メンバ値のビットごとの組み合わせ可能にする FlagsAttribute 属性含まれています。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<FlagsAttribute> _
Public Enumeration ValidationConstraints
Dim instance As ValidationConstraints
[FlagsAttribute] 
public enum ValidationConstraints
[FlagsAttribute] 
public enum class ValidationConstraints
/** @attribute FlagsAttribute() */ 
public enum ValidationConstraints
FlagsAttribute 
public enum ValidationConstraints
メンバメンバ
解説解説
使用例使用例

Enabled プロパティtrue であるフォーム直接的な子にのみ Validating イベント発生させるコード例を、次に示します

Imports System.Drawing
Imports System.Windows.Forms

Namespace ValidateChildrenWithConstraints
    _
    Class Form1
        Inherits Form

        Public Overloads Shared
 Sub Main(ByVal args() As
 String)
            Application.EnableVisualStyles()
            Application.Run(New Form1())
        End Sub

        Private Sub New()
            AddHandler Me.Load, AddressOf
 Form1_Load
        End Sub

        Dim WithEvents TextBox1, TextBox2,
 TextBox3 As TextBox
        Dim FlowPanel1 As FlowLayoutPanel
        Dim WithEvents SubTextBox1 As
 TextBox
        Dim WithEvents Button1 As
 Button

        Sub Form1_Load(ByVal sender As
 Object, ByVal e As EventArgs)
            ' Create controls on form.

            Me.Size = New Size(500, 300)
            Me.AutoValidate = AutoValidate.Disable

            TextBox1 = New TextBox()
            TextBox1.Location = New Point(20, 20)
            TextBox1.Size = New Size(75, TextBox1.Size.Height)
            TextBox1.CausesValidation = True
            Me.Controls.Add(TextBox1)

            TextBox2 = New TextBox()
            TextBox2.Location = New Point(105, 20)
            TextBox2.Size = New Size(75, TextBox2.Size.Height)
            TextBox2.CausesValidation = True
            Me.Controls.Add(TextBox2)

            TextBox3 = New TextBox()
            TextBox3.Location = New Point(190, 20)
            TextBox3.Size = New Size(75, TextBox3.Size.Height)
            TextBox3.Enabled = False
            TextBox3.CausesValidation = True
            Me.Controls.Add(TextBox3)

            Button1 = New Button()
            Button1.Text = "Click"
            Button1.Location = New Point(270, 20)
            Me.Controls.Add(Button1)

            FlowPanel1 = New FlowLayoutPanel()
            FlowPanel1.Size = New Size(400, 100)
            FlowPanel1.Dock = DockStyle.Bottom
            SubTextBox1 = New TextBox()
            SubTextBox1.CausesValidation = True
            FlowPanel1.Controls.Add(SubTextBox1)
            Me.Controls.Add(FlowPanel1)
        End Sub 'Form1_Load


        Sub SubTextBox1_Validating(ByVal sender
 As Object, ByVal e As
 System.ComponentModel.CancelEventArgs) Handles SubTextBox1.Validating
            MessageBox.Show("SubTextBox1 Validating!")
        End Sub 'SubTextBox1_Validating


        Sub TextBox1_Validating(ByVal sender
 As Object, ByVal e As
 System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
            MessageBox.Show("TextBox1 Validating!")
        End Sub 'TextBox1_Validating


        Sub TextBox2_Validating(ByVal sender
 As Object, ByVal e As
 System.ComponentModel.CancelEventArgs) Handles TextBox2.Validating
            MessageBox.Show("TextBox2 Validating!")
        End Sub 'TextBox2_Validating


        Sub TextBox3_Validating(ByVal sender
 As Object, ByVal e As
 System.ComponentModel.CancelEventArgs) Handles TextBox3.Validating
            MessageBox.Show("TextBox3 Validating!")
        End Sub 'TextBox3_Validating


        Sub Button1_Click(ByVal sender As
 Object, ByVal e As EventArgs)
 Handles button1.Click
            Me.ValidateChildren((ValidationConstraints.ImmediateChildren
 Or ValidationConstraints.Enabled))
        End Sub 'Button1_Click
    End Class 'Form1
End Namespace 'ValidateChildrenWithConstraints
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace ValidateChildrenWithConstraints
{
    class Form1 : Form
    {
        public static void
 Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

        private Form1()
        {
            this.Load += new EventHandler(Form1_Load);
        }

        void Form1_Load(object sender, EventArgs e)
        {
            // Create controls on form.
            TextBox textBox1, textBox2, textBox3;
            FlowLayoutPanel flowPanel1;
            TextBox subTextBox1;
            Button button1;

            this.Size = new Size(500, 300);
            this.AutoValidate = AutoValidate.Disable;

            textBox1 = new TextBox();
            textBox1.Location = new Point(20, 20);
            textBox1.Size = new Size(75, textBox1.Size.Height);
            textBox1.CausesValidation = true;
            textBox1.Validating += new System.ComponentModel.CancelEventHandler(textBox1_Validating);
            this.Controls.Add(textBox1);

            textBox2 = new TextBox();
            textBox2.Location = new Point(105, 20);
            textBox2.Size = new Size(75, textBox2.Size.Height);
            textBox2.CausesValidation = true;
            textBox2.Validating += new System.ComponentModel.CancelEventHandler(textBox2_Validating);
            this.Controls.Add(textBox2);

            textBox3 = new TextBox();
            textBox3.Location = new Point(190, 20);
            textBox3.Size = new Size(75, textBox3.Size.Height);
            textBox3.Enabled = false;
            textBox3.CausesValidation = true;
            textBox3.Validating += new System.ComponentModel.CancelEventHandler(textBox3_Validating);
            this.Controls.Add(textBox3);

            button1 = new Button();
            button1.Text = "Click";
            button1.Location = new Point(270, 20);
            button1.Click += new EventHandler(button1_Click);
            this.Controls.Add(button1);

            flowPanel1 = new FlowLayoutPanel();
            flowPanel1.Size = new Size(400, 100);
            flowPanel1.Dock = DockStyle.Bottom;
            subTextBox1 = new TextBox();
            subTextBox1.CausesValidation = true;
            subTextBox1.Validating += new System.ComponentModel.CancelEventHandler(subTextBox1_Validating);
            flowPanel1.Controls.Add(subTextBox1);
            this.Controls.Add(flowPanel1);
        }

        void subTextBox1_Validating(object sender, System.ComponentModel.CancelEventArgs
 e)
        {
            MessageBox.Show("subTextBox1 Validating!");
        }

        void textBox1_Validating(object sender, System.ComponentModel.CancelEventArgs
 e)
        {
            MessageBox.Show("textBox1 Validating!");
        }

        void textBox2_Validating(object sender, System.ComponentModel.CancelEventArgs
 e)
        {
            MessageBox.Show("textBox2 Validating!");
        }

        void textBox3_Validating(object sender, System.ComponentModel.CancelEventArgs
 e)
        {
            MessageBox.Show("textBox3 Validating!");
        }

        void button1_Click(object sender, EventArgs e)
        {
            this.ValidateChildren(ValidationConstraints.ImmediateChildren
 | ValidationConstraints.Enabled);
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ValidationConstraints 列挙体」の関連用語

ValidationConstraints 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ValidationConstraints 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS