Page 1 of 1

สอบถามเรื่อง error code '13 ครับ

Posted: Mon Feb 19, 2018 1:28 pm
by jullathep

Code: Select all

Private Sub CommandButton1_Click()
If TextBox1.Text = ("MgO") And TextBox3.Text = ("Mn") And TextBox5.Text = ("Zn") Then
        Label1.Caption = ("MgO") & TextBox2.Text & " " And Label1.Caption = ("Mn") & TextBox4.Text & " " And Label1.Caption = ("Zn") & TextBox6.Text & " "
End If
End Sub
พอดีผมต้องการให้มัน แสดงผลต่อกันใน Label แต่เกิด Error รบกวนช่วยดู Code หน่อยครับ ขอบคุณมากครับ

Re: สอบถามเรื่อง error code '13 ครับ

Posted: Mon Feb 19, 2018 3:24 pm
by eyepop99
แก้โค๊ดเป็น

Code: Select all

Private Sub CommandButton1_Click()
If TextBox1.Text = ("MgO") And TextBox3.Text = ("Mn") And TextBox5.Text = ("Zn") Then
        Label1.Caption = ("MgO") & TextBox2.Text & " " & "Mn" & TextBox4.Text & " " & "Zn" & TextBox6.Text & " "
End If
End Sub

Re: สอบถามเรื่อง error code '13 ครับ

Posted: Mon Feb 19, 2018 3:31 pm
by jullathep
eyepop99 wrote: Mon Feb 19, 2018 3:24 pm แก้โค๊ดเป็น

Code: Select all

Private Sub CommandButton1_Click()
If TextBox1.Text = ("MgO") And TextBox3.Text = ("Mn") And TextBox5.Text = ("Zn") Then
        Label1.Caption = ("MgO") & TextBox2.Text & " " & "Mn" & TextBox4.Text & " " & "Zn" & TextBox6.Text & " "
End If
End Sub
ขอบคุณมากครับ

Re: สอบถามเรื่อง error code '13 ครับ

Posted: Mon Feb 19, 2018 3:41 pm
by puriwutpokin
ุ้ถ้าที่ Label เปลี่ยนค่าควรใช้เป็นโค้ดนี้ครับ

Code: Select all

Private Sub CommandButton1_Click()
If TextBox1.Text <> "" And TextBox3.Text <> "" And TextBox5.Text <> "" Then
        Label1.Caption = TextBox1.Text & TextBox2.Text & " " & TextBox3.Text & TextBox4.Text & " " & TextBox5.Text & " " & TextBox6.Text
End If
End Sub
 

Re: สอบถามเรื่อง error code '13 ครับ

Posted: Mon Feb 19, 2018 3:59 pm
by jullathep
puriwutpokin wrote: Mon Feb 19, 2018 3:41 pm ุ้ถ้าที่ Label เปลี่ยนค่าควรใช้เป็นโค้ดนี้ครับ

Code: Select all

Private Sub CommandButton1_Click()
If TextBox1.Text <> "" And TextBox3.Text <> "" And TextBox5.Text <> "" Then
        Label1.Caption = TextBox1.Text & TextBox2.Text & " " & TextBox3.Text & TextBox4.Text & " " & TextBox5.Text & " " & TextBox6.Text
End If
End Sub
 
ขอบคุณมากครับ พี่