Справочник функций

Ваш аккаунт

Войти через: 
Забыли пароль?
Регистрация
Информацию о новых материалах можно получать и без регистрации:

Почтовая рассылка

Подписчиков: -1
Последний выпуск: 19.06.2015

Пожалуйста,помогите объяснить код в vb))

86K
18 марта 2013 года
Ainur Kelisova
6 / / 18.03.2013
Public Class Exam1_SL

Dim Text1 As String = New String("Familiar concepts, language, and real-world conventions in an interface can take advantage of knowledge users already have and, therefore, can make the interface more familiar and easier to use.")
Dim Text2 As String = New String("Users will make errors; therefore, they need easy ways to recover from those errors. ")
Dim Text3 As String = New String("Errors can come about because users make mistakes in perception, lack knowledge of what to do next, recall the gist of commands rather than the precise syntax—or they may simply slip when they go to type or point. Some of these mistakes can be prevented by, say, an interface only showing the actions that are acceptable at a particular point (for example, by graying out inappropriate buttons). Other mistakes can be caught as soon as users make them (for example, by the interface refusing to accept an incorrect abbreviation of a U.S. state in an address form).")
Dim Text4 As String = New String("The value of accelerators comes primarily from the motor processes of the user. Typing single keys is typically faster than continually moving the hand from keyboard to mouse and pointing to something on the screen. Furthermore, skilled users will develop plans of action that they will want to execute frequently, and an interface that supports this kind of tailoring will allow these plans to be captured in the interface itself. ")
Dim Text5 As String = New String("This heuristic is simply an admonition to give the user sufficient information to understand error situations.")



Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub TextBox2_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

Button2.Enabled = False
Button1.Enabled = True
TextBox1.Text = ""
Label11.Text = ""
TextBox3.Text = ""
End Sub


Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Button2.Enabled = True
Button1.Enabled = False
TextBox1.Text = ""
Label11.Text = ""

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If TextBox2.Text = "1" Then
TextBox1.Text = Text1
ElseIf TextBox2.Text = "2" Then
TextBox1.Text = Text2
ElseIf TextBox2.Text = "3" Then
TextBox1.Text = Text3
ElseIf TextBox2.Text = "4" Then
TextBox1.Text = Text4
ElseIf TextBox2.Text = "5" Then
TextBox1.Text = Text5
Else
MsgBox("Please enter value between 1 and 5", MsgBoxStyle.Exclamation, "search string")
TextBox2.Focus()

End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i, position As Integer
Dim control1 As Boolean = False
Dim control2 As Boolean = False
Dim control3 As Boolean = False
Dim control4 As Boolean = False
Dim control5 As Boolean = False

If TextBox3.Text = "" Then
TextBox1.Text = "Please enter a valid search string."
Label11.Text = ""
Else
i = 1
Do
Label11.Text = ""
Dim search_String As String
position = 0
Select Case i
Case 1
search_String = Text1
Case 2
search_String = Text2
Case 3
search_String = Text3
Case 4
search_String = Text4
Case Else
search_String = Text5
End Select

position = InStr(1, search_String, TextBox3.Text, CompareMethod.Text)

If position <> 0 Then
Select Case i
Case 1
control1 = True
Case 2
control2 = True
Case 3
control3 = True
Case 4
control4 = True
Case Else
control5 = True
End Select
End If
i += 1
Loop Until i = 6

If control1 = True Then
TextBox1.Text += Label1.Text & Chr(13) & Text1
End If
If control2 = True Then
If control1 = True Then
Label11.Text += Chr(13) & Label2.Text
Else
TextBox1.Text = Label2.Text & Chr(13) & Text2
End If
End If
If control3 = True Then
If control1 = True Or control2 = True Then
Label11.Text += Chr(13) & Label3.Text
Else
TextBox1.Text = Label3.Text & Chr(13) & Text3
End If
End If
If control4 = True Then
If control1 = True Or control2 = True Or control3 = True Then
Label11.Text += Chr(13) & Label4.Text
Else
TextBox1.Text = Label4.Text & Chr(13) & Text4
End If
End If
If control5 = True Then
If control1 = True Or control2 = True Or control3 = True Or control4 = True Then
Label11.Text += Chr(13) & Label5.Text
Else
TextBox1.Text = Label5.Text & Chr(13) & Text5
End If

End If
If control1 = False And control2 = False And control3 = False And control4 = False And control5 = False Then
TextBox1.Text = "No match found."
TextBox3.Focus()
End If
End If
control1 = False
control2 = False
control3 = False
control4 = False
control5 = False
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()

End Sub
End Class
327
18 марта 2013 года
UserNet2008
748 / / 03.04.2010
Код:
Public Class Exam1_SL

Dim Text1 As String = New String("Familiar concepts, language, and real-world conventions in an interface can take advantage of knowledge users already have and, therefore, can make the interface more familiar and easier to use.")
Dim Text2 As String = New String("Users will make errors; therefore, they need easy ways to recover from those errors. ")
Dim Text3 As String = New String("Errors can come about because users make mistakes in perception, lack knowledge of what to do next, recall the gist of commands rather than the precise syntax—or they may simply slip when they go to type or point. Some of these mistakes can be prevented by, say, an interface only showing the actions that are acceptable at a particular point (for example, by graying out inappropriate buttons). Other mistakes can be caught as soon as users make them (for example, by the interface refusing to accept an incorrect abbreviation of a U.S. state in an address form).")
Dim Text4 As String = New String("The value of accelerators comes primarily from the motor processes of the user. Typing single keys is typically faster than continually moving the hand from keyboard to mouse and pointing to something on the screen. Furthermore, skilled users will develop plans of action that they will want to execute frequently, and an interface that supports this kind of tailoring will allow these plans to be captured in the interface itself. ")
Dim Text5 As String = New String("This heuristic is simply an admonition to give the user sufficient information to understand error situations.")


' События когда меняется текст TextBox1 ???
Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
' События когда меняется текст TextBox2
Private Sub TextBox2_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

Button2.Enabled = False 'блокируем кнопку
Button1.Enabled = True'разблокируем кнопку
TextBox1.Text = "" 'удалить текст
Label11.Text = "" 'удалить текст
TextBox3.Text = "" 'удалить текст
End Sub

' События когда меняется текст TextBox3
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Button2.Enabled = True 'блокируем кнопку
Button1.Enabled = False 'разблокируем кнопку
TextBox1.Text = "" 'удалить текст
Label11.Text = "" 'удалить текст

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If TextBox2.Text = "1" Then ' Выбираем 1-5
TextBox1.Text = Text1
ElseIf TextBox2.Text = "2" Then
TextBox1.Text = Text2
ElseIf TextBox2.Text = "3" Then
TextBox1.Text = Text3
ElseIf TextBox2.Text = "4" Then
TextBox1.Text = Text4
ElseIf TextBox2.Text = "5" Then
TextBox1.Text = Text5
Else
MsgBox("Please enter value between 1 and 5", MsgBoxStyle.Exclamation, "search string")
TextBox2.Focus() ' Делаем окно активным

End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i, position As Integer
Dim control1 As Boolean = False
Dim control2 As Boolean = False
Dim control3 As Boolean = False
Dim control4 As Boolean = False
Dim control5 As Boolean = False

If TextBox3.Text = "" Then
TextBox1.Text = "Please enter a valid search string."
Label11.Text = "" 'удалить текст
Else
i = 1
Do
Label11.Text = "" 'удалить текст
Dim search_String As String
position = 0
Select Case i ' Выбираем 1-4
Case 1
search_String = Text1
Case 2
search_String = Text2
Case 3
search_String = Text3
Case 4
search_String = Text4
Case Else
search_String = Text5
End Select

position = InStr(1, search_String, TextBox3.Text, CompareMethod.Text) 'Возвращает позицию в тексте

If position <> 0 Then
Select Case i  ' Выбираем 1-4
Case 1
control1 = True
Case 2
control2 = True
Case 3
control3 = True
Case 4
control4 = True
Case Else
control5 = True
End Select
End If
i += 1
Loop Until i = 6

If control1 = True Then
TextBox1.Text += Label1.Text & Chr(13) & Text1 ' Chr(13) - это есть перевод каретки на новую строку
End If
If control2 = True Then
If control1 = True Then
Label11.Text += Chr(13) & Label2.Text
Else
TextBox1.Text = Label2.Text & Chr(13) & Text2
End If
End If
If control3 = True Then
If control1 = True Or control2 = True Then
Label11.Text += Chr(13) & Label3.Text
Else
TextBox1.Text = Label3.Text & Chr(13) & Text3
End If
End If
If control4 = True Then
If control1 = True Or control2 = True Or control3 = True Then
Label11.Text += Chr(13) & Label4.Text
Else
TextBox1.Text = Label4.Text & Chr(13) & Text4
End If
End If
If control5 = True Then
If control1 = True Or control2 = True Or control3 = True Or control4 = True Then
Label11.Text += Chr(13) & Label5.Text
Else
TextBox1.Text = Label5.Text & Chr(13) & Text5
End If

End If
If control1 = False And control2 = False And control3 = False And control4 = False And control5 = False Then 'Если все переменные  False
TextBox1.Text = "No match found."
TextBox3.Focus() ' Делаем окно активным
End If
End If
control1 = False
control2 = False
control3 = False
control4 = False
control5 = False
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close() ' закрываем программу

End Sub
End Class
86K
18 марта 2013 года
Ainur Kelisova
6 / / 18.03.2013
спасибооо большое))))а что значит :
Dim control1 As Boolean = False
Dim control2 As Boolean = False
Dim control3 As Boolean = False
Dim control4 As Boolean = False
Dim control5 As Boolean = False
?)
327
18 марта 2013 года
UserNet2008
748 / / 03.04.2010
Цитата: Ainur Kelisova
спасибооо большое))))а что значит :
Dim control1 As Boolean = False
Dim control2 As Boolean = False
Dim control3 As Boolean = False
Dim control4 As Boolean = False
Dim control5 As Boolean = False
?)


Переменная объявлена как Буален т.е значения может быть False Ложь или True Истина

86K
18 марта 2013 года
Ainur Kelisova
6 / / 18.03.2013
спасибо)))
Реклама на сайте | Обмен ссылками | Ссылки | Экспорт (RSS) | Контакты
Добавить статью | Добавить исходник | Добавить хостинг-провайдера | Добавить сайт в каталог