2013-10-12 4 views
0

TextBox 명령을 여러 개 삽입하면이 오류가 발생합니다.문자열 "I"에서 'Boolean'유형으로의 변환이 유효하지 않습니다.

If TextBox1.Text = "I" Then TextBox20.Text = "I" And TextBox32.Text = "I" And TextBox44.Text = "I" 
If TextBox2.Text = "I" Then TextBox19.Text = "I" And TextBox31.Text = "I" & TextBox43.Text = "I" 
If TextBox3.Text = "I" Then TextBox17.Text = "I" And TextBox29.Text = "I" & TextBox42.Text = "I" 
If TextBox4.Text = "I" Then TextBox18.Text = "I" And TextBox28.Text = "I" & TextBox41.Text = "I" 
If TextBox8.Text = "I" Then TextBox16.Text = "I" And TextBox27.Text = "I" & TextBox40.Text = "I" 
If TextBox7.Text = "I" Then TextBox15.Text = "I" And TextBox26.Text = "I" & TextBox39.Text = "I" 
If TextBox6.Text = "I" Then TextBox14.Text = "I" And TextBox25.Text = "I" & TextBox38.Text = "I" 
If TextBox5.Text = "I" Then TextBox13.Text = "I" And TextBox24.Text = "I" & TextBox37.Text = "I" 
If TextBox30.Text = "I" Then TextBox11.Text = "I" And TextBox23.Text = "I" 
If TextBox33.Text = "I" Then TextBox10.Text = "I" And TextBox22.Text = "I" & TextBox35.Text = "I" 
If TextBox48.Text = "I" Then TextBox47.Text = "I" And TextBox21.Text = "I" & TextBox34.Text = "I" 
If TextBox52.Text = "I" Then TextBox51.Text = "I" And TextBox46.Text = "I" & TextBox45.Text = "I" 
If TextBox9.Text = "I" Then TextBox12.Text = "I" And TextBox50.Text = "I" & TextBox49.Text = "I" 

어떤 제안 :

문자열에서 변환은 "나는" '부울'를 입력하기 위해 내가이 오류가있다 얻고있는

코드 유효하지 않습니다? 그들은 모두 If TextBox으로 시작합니다. TextBox

+3

당신이 갑자기 &에서 &로 바꾼 것은 놀라운 일입니다. –

+0

당신은 정말로 당신의 텍스트 상자를위한 더 나은 명명 규칙을 제시 할 필요가 있습니다. (위와 같이 반복적 인 코드를 처리하는 더 좋은 방법) – Neolisk

답변

2

다른 줄에 대한 예제로 한 줄만 수정했습니다.

If TextBox1.Text = "I" Then 
     TextBox20.Text = "I" 
     TextBox32.Text = "I" 
     TextBox44.Text = "I" 
End If 

AND operator

는 명령의 실행을 반복하지 부울 TRUE/FALSE 결과 결과 두 식 사이에서 논리 연산을 수행하는데 사용된다.

+0

와우! 정말 고맙습니다! 나는 7 분 안에 답을 표시 할 것입니다. (그 이유는 제가 받아 들일 수있는 때입니다. 왜 그런지 모르십니까?) 처음 일한 것은 나머지를 시도 할 것입니다. 고맙습니다!! –

+0

7 분을 기다리는 동안 [서쪽 문제에서 가장 빠른 총] (http://meta.stackexchange.com/questions/9731/fastest-gun-in-the-west-problem) – Steve

+0

으로 자신을 즐겁게 할 수 있습니다. 다시 한번 감사드립니다. –

관련 문제