Перевести код с Visual Basic 6.0 - Visual Basic .NET
Формулировка задачи:
Решение задачи: «Перевести код с Visual Basic 6.0»
textual
Листинг программы
Public Class Form1 Dim mytext As String Dim allmytext As String Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Label1.Text = "Микдори калимахо = " & NumWord(TextBox1.Text) & vbCrLf & _ "Микдори ракамхо = " & NumDigit(TextBox1.Text) & vbCrLf & _ "Микдори чумлахо = " & Jumla(TextBox1.Text) & vbCrLf & _ "Микдори харфхо = " & (Harf(TextBox1.Text) - Jumla(TextBox1.Text)) End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click allmytext = IO.File.ReadAllText(Application.StartupPath & "\123.txt", System.Text.Encoding.Default) TextBox1.Text = allmytext End Sub Function NumDigit(ByVal Value As String) As Integer Value = Trim$(Value) Dim cuchar For p = 1 To Len(Value) cuchar = Mid$(Value, p, 1) NumDigit = NumDigit - (cuchar >= "0" And cuchar <= "9") Next End Function Function NumWord(ByVal Value As String) As Integer Dim p As Long, curword As String, cuchar As String Value = Trim$(Value) For p = 1 To Len(Value) cuchar = LCase(Mid$(Value, p, 1)) If (cuchar >= "a" And cuchar <= "z") Or (cuchar >= "а" And cuchar <= "я") Then curword = curword & cuchar Else NumWord = NumWord - (Len(curword) > 0) curword = vbNullString End If Next End Function Function Jumla(ByVal Value As String) As Integer Value = Trim$(Value) Dim cuchar For p = 1 To Len(Value) cuchar = Mid$(Value, p, 1) Jumla = Jumla - (cuchar = ".") Next End Function Function Harf(ByVal Value As String) As Integer Value = Trim$(Value) Dim cuchar For p = 1 To Len(Value) cuchar = Mid$(Value, p, 1) Harf = Harf - (cuchar >= ".") Next End Function End Class
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д