کمک برای UserForm

Collapse
این تاپیک قفل است.
X
X
 
  • زمان
  • نمایش
حذف همه
new posts
  • میثم مقدم نیا

    • 2017/03/23
    • 558
    • 41.00

    [حل شده] کمک برای UserForm

    سلام
    من برای اشکار و مخفی کردن مقادیر در یوزر فرم به وسیله CheckBox از کد دستور زیر استفاده میکنم.


    کد PHP:
    Private Sub CheckBox1_Click()
    If 
    CheckBox1.Value = True Then
    TextBox1
    .Visible = False
    TextBox2
    .Visible = False
    TextBox3
    .Visible = True
    TextBox4
    .Visible = True
    Label1
    .Visible = False
    Label2
    .Visible = False
    Label3
    .Visible = True
    Label4
    .Visible = True
    CommandButton1
    .Visible = False
    CommandButton2
    .Visible = True

    Else

    TextBox1.Visible = True
    TextBox2
    .Visible = True
    TextBox3
    .Visible = False
    TextBox4
    .Visible = False
    Label1
    .Visible = True
    Label2
    .Visible = True
    Label3
    .Visible = False
    Label4
    .Visible = False
    CommandButton1
    .Visible = True
    CommandButton2
    .Visible = False
    End 
    If
    End Sub 
    حالا من میخوام بجای CheckBox از CommandButton استفاده کنم
    این کد را برای CommandButton چطور باید تغییر بدم
    [HR][SIZE=5][COLOR="#0000FF"][FONT=Times New Roman][B] در سرزمینی کہ نتوان مردانہ زیست ، مردانہ مردن بهتر از این زندگیست [/B][/FONT][/COLOR][/SIZE][/HR]
  • iranweld

    • 2015/03/29
    • 3341

    #2
    با سلام

    این کد CommandButton2 رو اگر hide باشه unhide و برعکس عمل میکنه

    کد PHP:
    Private Sub CommandButton1_Click()

    If 
    CommandButton2.Visible = True Then

    'TextBox1.Visible = False
    '
    TextBox2.Visible = False
    'TextBox3.Visible = True
    '
    TextBox4.Visible = True
    'Label1.Visible = False
    '
    Label2.Visible = False
    'Label3.Visible = True
    '
    Label4.Visible = True

    CommandButton2
    .Visible = False

    Else

    'TextBox1.Visible = True
    '
    TextBox2.Visible = True
    'TextBox3.Visible = False
    '
    TextBox4.Visible = False
    'Label1.Visible = True
    '
    Label2.Visible = True
    'Label3.Visible = False
    '
    Label4.Visible = False

    CommandButton2
    .Visible = True

    End 
    If

    End Sub 

    کامنت

    • میثم مقدم نیا

      • 2017/03/23
      • 558
      • 41.00

      #3
      نوشته اصلی توسط iranweld
      با سلام

      این کد CommandButton2 رو اگر hide باشه unhide و برعکس عمل میکنه

      کد PHP:
      Private Sub CommandButton1_Click()

      If 
      CommandButton2.Visible = True Then

      'TextBox1.Visible = False
      '
      TextBox2.Visible = False
      'TextBox3.Visible = True
      '
      TextBox4.Visible = True
      'Label1.Visible = False
      '
      Label2.Visible = False
      'Label3.Visible = True
      '
      Label4.Visible = True

      CommandButton2
      .Visible = False

      Else

      'TextBox1.Visible = True
      '
      TextBox2.Visible = True
      'TextBox3.Visible = False
      '
      TextBox4.Visible = False
      'Label1.Visible = True
      '
      Label2.Visible = True
      'Label3.Visible = False
      '
      Label4.Visible = False

      CommandButton2
      .Visible = True

      End 
      If

      End Sub 
      ممنون از راهنمایتون

      - - - Updated - - -

      نوشته اصلی توسط iranweld
      با سلام

      این کد CommandButton2 رو اگر hide باشه unhide و برعکس عمل میکنه

      کد PHP:
      Private Sub CommandButton1_Click()

      If 
      CommandButton2.Visible = True Then

      'TextBox1.Visible = False
      '
      TextBox2.Visible = False
      'TextBox3.Visible = True
      '
      TextBox4.Visible = True
      'Label1.Visible = False
      '
      Label2.Visible = False
      'Label3.Visible = True
      '
      Label4.Visible = True

      CommandButton2
      .Visible = False

      Else

      'TextBox1.Visible = True
      '
      TextBox2.Visible = True
      'TextBox3.Visible = False
      '
      TextBox4.Visible = False
      'Label1.Visible = True
      '
      Label2.Visible = True
      'Label3.Visible = False
      '
      Label4.Visible = False

      CommandButton2
      .Visible = True

      End 
      If

      End Sub 
      ممنون از راهنمایتون
      [HR][SIZE=5][COLOR="#0000FF"][FONT=Times New Roman][B] در سرزمینی کہ نتوان مردانہ زیست ، مردانہ مردن بهتر از این زندگیست [/B][/FONT][/COLOR][/SIZE][/HR]

      کامنت

      چند لحظه..