Visual Basic

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by getMessage, 24 Nov 2008.

  1. getMessage

    getMessage New Member

    Joined:
    26 Oct 2007
    Messages:
    11
    Likes Received:
    2
    Reputations:
    0
    Code:
    ChangeLang.doc
    Public Sub ChangeLang()
    Dim S$, s1$
    S = Selection.Text
    Dim i&, c$
    For i = 1 To Len(S)
    c = Mid$(S, i, 1)
    Select Case c
    'английские буквы в русские
    Code:
    Case "q": c = "й"
    Case "w": c = "ц"
    Case "e": c = "у"
    Case "r": c = "к"
    Case "t": c = "е"
    Case "y": c = "н"
    Case "u": c = "г"
    Case "i": c = "ш"
    Case "o": c = "щ"
    Case "p": c = "з"
    Case "[": c = "х"
    Case "]": c = "ъ"
    Case "a": c = "ф"
    Case "s": c = "ы"
    Case "d": c = "в"
    Case "f": c = "а"
    Case "g": c = "п"
    Case "h": c = "р"
    Case "j": c = "о"
    Case "k": c = "л"
    Case "l": c = "д"
    Case ";": c = "ж"
    Case "'": c = "э"
    Case "z": c = "я"
    Case "x": c = "ч"
    Case "c": c = "с"
    Case "v": c = "м"
    Case "b": c = "и"
    Case "n": c = "т"
    Case "m": c = "ь"
    Case ",": c = "б"
    Case ".": c = "ю"
    
    Case "Q": c = "Й"
    Case "W": c = "Ц"
    Case "E": c = "У"
    Case "R": c = "К"
    Case "T": c = "Е"
    Case "Y": c = "Н"
    Case "U": c = "Г"
    Case "I": c = "Ш"
    Case "O": c = "Щ"
    Case "P": c = "З"
    Case "{": c = "Х"
    Case "}": c = "Ъ"
    Case "A": c = "Ф"
    Case "S": c = "Ы"
    Case "D": c = "В"
    Case "F": c = "А"
    Case "G": c = "П"
    Case "H": c = "Р"
    Case "J": c = "О"
    Case "K": c = "Л"
    Case "L": c = "Д"
    Case ":": c = "Ж"
    Case """": c = "Э"
    Case "Z": c = "Я"
    Case "X": c = "Ч"
    Case "C": c = "С"
    Case "V": c = "М"
    Case "B": c = "И"
    Case "N": c = "Т"
    Case "M": c = "Ь"
    Case "<": c = "Б"
    Case ">": c = "Ю"
    'Русские буквы в английские
    HTML:
    Case "й": c = "q"
    Case "ц": c = "w"
    Case "у": c = "e"
    Case "к": c = "r"
    Case "е": c = "t"
    Case "н": c = "y"
    Case "г": c = "u"
    Case "ш": c = "i"
    Case "щ": c = "o"
    Case "з": c = "p"
    Case "х": c = "["
    Case "ъ": c = "]"
    Case "ф": c = "a"
    Case "ы": c = "s"
    Case "в": c = "d"
    Case "а": c = " 
    Помогите, в чем моя ошибка ?
     
  2. ruzzer

    ruzzer Elder - Старейшина

    Joined:
    29 Jul 2007
    Messages:
    43
    Likes Received:
    10
    Reputations:
    3
    А в чем именно ошибка? не правильно работает или не компилит?
     
  3. getMessage

    getMessage New Member

    Joined:
    26 Oct 2007
    Messages:
    11
    Likes Received:
    2
    Reputations:
    0
    Знаю) учусь только ) не компилит ((
     
  4. ruzzer

    ruzzer Elder - Старейшина

    Joined:
    29 Jul 2007
    Messages:
    43
    Likes Received:
    10
    Reputations:
    3
    по моему в конце End Select и Next не хватает...
     
  5. getMessage

    getMessage New Member

    Joined:
    26 Oct 2007
    Messages:
    11
    Likes Received:
    2
    Reputations:
    0
    Это как будет выглядеть ?
    Типо:

    Case "ф": c = "a"
    Case "ы": c = "s"
    Case "в": c = "d"
    Case "а": c = "
    Next
    End Select

    Так ?
     
  6. ruzzer

    ruzzer Elder - Старейшина

    Joined:
    29 Jul 2007
    Messages:
    43
    Likes Received:
    10
    Reputations:
    3
    Case "ф": c = "a"
    Case "ы": c = "s"
    Case "в": c = "d"
    Case "а": c = "
    End Selecеt
    Next

    вот так вроде
     
  7. getMessage

    getMessage New Member

    Joined:
    26 Oct 2007
    Messages:
    11
    Likes Received:
    2
    Reputations:
    0
    Блин, забыл что тут ограничено символов (((


    Case "а": c = "f"
    Case "п": c = "g"
    Case "р": c = "h"
    Case "о": c = "j"
    Case "л": c = "k"
    Case "д": c = "l"
    Case "ж": c = ";"
    Case "э": c = "'"
    Case "я": c = "z"
    Case "ч": c = "x"
    Case "с": c = "c"
    Case "м": c = "v"
    Case "и": c = "b"
    Case "т": c = "n"
    Case "ь": c = "m"
    Case "б": c = ","
    Case "ю": c = "."

    Case "Й": c = "Q"
    Case "Ц": c = "W"
    Case "У": c = "E"
    Case "К": c = "R"
    Case "Е": c = "T"
    Case "Н": c = "Y"
    Case "Г": c = "U"
    Case "Ш": c = "I"
    Case "Щ": c = "O"
    Case "З": c = "P"
    Case "Х": c = "{"
    Case "Ъ": c = "}"
    Case "Ф": c = "A"
    Case "Ы": c = "S"
    Case "В": c = "D"
    Case "F": c = "F"
    Case "П": c = "G"
    Case "Р": c = "H"
    Case "О": c = "J"
    Case "Л": c = "K"
    Case "Д": c = "L"
    Case "Ж": c = ":"
    Case "Э": c = """"
    Case "Я": c = "Z"
    Case "Ч": c = "X"
    Case "С": c = "C"
    Case "М": c = "М"
    Case "И": c = "B"
    Case "Т": c = "N"
    Case "Ь": c = "M"
    Case "Б": c = "<"
    Case "Ю": c = ">"
    End Select
    s1 = s1 & c
    Next
    Selection.TypeText Text:=s1
    End Sub
     
  8. ruzzer

    ruzzer Elder - Старейшина

    Joined:
    29 Jul 2007
    Messages:
    43
    Likes Received:
    10
    Reputations:
    3
    Хочешь верь хочешь не верь. У меня в VB 6.0 все норм компилит и работает. Ты это в ворде писал?
     
  9. getMessage

    getMessage New Member

    Joined:
    26 Oct 2007
    Messages:
    11
    Likes Received:
    2
    Reputations:
    0
    Да ))
     
  10. ruzzer

    ruzzer Elder - Старейшина

    Joined:
    29 Jul 2007
    Messages:
    43
    Likes Received:
    10
    Reputations:
    3
    Что это?
    не паскаль ведь.
    Вот так надо:
    Selection.TypeText Text=s1