PDA

View Full Version : خلاصه نویسی دستور شرط



پرستو پارسایی
چهارشنبه 14 آبان 1393, 23:50 عصر
با سلام من میخواستم خلاصه نویسی صحیح دستور شرط زیر رو بدونم ممنون میشم در صورت اطلاع پاسخ دهید.

txtChangCar.Text = txtNameCar.Text + txtNumberCar.Text If txtChangCar.Text = "BMW1" Then
LoadPic5(txtChangCar.Text, pic1)
Else
If txtChangCar.Text = "BMW2" Then
LoadPic5(txtChangCar.Text, pic2)
Else
If txtChangCar.Text = "BMW3" Then
LoadPic5(txtChangCarText, pic3)
Else
If txtChangCar.Text = "BMW4" Then
LoadPic5(txtChangCar.Text, pic4)
Else
If txtChangCar.Text = "BMW5" Then
LoadPic5(txtChangCar.Text, pic5)
Else
If txtChangCar.Text = "BMW6" Then
LoadPic5(txtChangCar.Text, pic6)
Else
If txtChangCar.Text = "BMW7" Then
LoadPic5(txtChangCar.Text, pic7)
Else
If txtChangCar.Text = "BMW8" Then
LoadPic5(txtChangCar.Text, pic8)
Else
If txtChangCar.Text = "BMW9" Then
LoadPic5(txtChangCarText, pic9)
Else
If txtChangCar.Text = "BMW10" Then
LoadPic5(txtChangCar.Text, pic10)
Else
If txtChangCar.Text = "BMW11" Then
LoadPic5(txtChangCar.Text, pic11)
Else
If txtChangCar.Text = "BMW12" Then
LoadPic5(txtChangCar.Text, pic12)
Else
If txtChangCar.Text = "BMW13" Then
LoadPic5(txtChangCar.Text, pic13)
Else
If txtChangCar.Text = "BMW14" Then
LoadPic5(txtChangCar.Text, pic14)
Else
If txtChangCar.Text = "BMW15" Then
LoadPic5(txtChangCar.Text, pic15)
Else
If txtChangCar.Text = "BMW16" Then
LoadPic5(txtChangCar.Text, pic16)
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
با سپاس

محمد آشتیانی
پنج شنبه 15 آبان 1393, 01:27 صبح
سلام
با دستور Case به این صورت میشه


txtChangCar.Text = txtNameCar.Text + txtNumberCar.Text
Dim T As String = txtChangCar.Text
Select Case T
Case "BMW1" : LoadPic5(T, Pic1)
Case "BMW2" : LoadPic5(T, Pic2)
Case "BMW3" : LoadPic5(T, Pic3)
Case "BMW4" : LoadPic5(T, Pic4)
Case "BMW5" : LoadPic5(T, Pic5)
Case "BMW6" : LoadPic5(T, Pic6)
Case "BMW7" : LoadPic5(T, Pic7)
Case "BMW8" : LoadPic5(T, Pic8)
Case "BMW9" : LoadPic5(T, Pic9)
Case "BMW10" : LoadPic5(T, Pic10)
Case "BMW11" : LoadPic5(T, Pic11)
Case "BMW12" : LoadPic5(T, Pic12)
Case "BMW13" : LoadPic5(T, Pic13)
Case "BMW14" : LoadPic5(T, Pic14)
Case "BMW15" : LoadPic5(T, Pic15)
Case "BMW16" : LoadPic5(T, Pic16)
End Select