With...End With允许对指定的对像执行一系列语句,而不必重新限定对象的名称!

  基本用法:

   With object

   [statements]

  End with


      举例如下:

  With Me.TextBox1
            .Text = "Text with...end with"
            .TextAlign = HorizontalAlignment.Center
            .BorderStyle = BorderStyle.None
            .AutoSize = True
        End With

  with... end with的嵌套

  With Me.TextBox1
            .Text = "Text with...end with" 
     .TextAlign = HorizontalAlignment.Center 
     .BorderStyle = BorderStyle.None
     .ReadOnly = True
            With Me
                .StartPosition = FormStartPosition.CenterScreen
                .MaximizeBox = False
                .MinimizeBox = False
                .Opacity = 50%
                .FormBorderStyle = FormBorderStyle.FixedSingle
                .ShowInTaskbar = False
            End With
        End With

相关文章:

  • 2021-12-07
  • 2021-07-29
  • 2021-09-22
  • 2021-08-28
  • 2021-04-29
  • 2021-08-26
猜你喜欢
  • 2022-12-23
  • 2021-11-01
  • 2022-03-03
  • 2022-12-23
  • 2021-07-11
  • 2021-11-30
相关资源
相似解决方案