Wątek przeniesiony 2015-02-02 17:57 z C# i .NET przez somekind.

Generator haseł MySQL i błąd NotImplementedException

0

Witam tworze generator haseł Mysql (hash) i przy naduszeniu buttonu "Generuj" wyskakuje komunikat oraz pojawia się nowa funkcja.

Imports System
Imports System.Text
Imports System.Security.Cryptography
Public Class Form1
    Public Function Generatorhash(ByVal str As String) As String
        Dim get_h = New SHA1Managed().ComputeHash(New SHA1Managed().ComputeHash(Encoding.UTF8.GetBytes(a)))
        Dim pc_h As New StringBuilder(get_h.Length)
        For Each pa_p As Byte In get_h
            pc_h.Append(pa_p.ToString("X2"))
        Next
        Return "*" & pc_h.ToString()
    End Function
    Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        If CheckBox1.Checked Then
            TextBox2.UseSystemPasswordChar = True
        Else
            TextBox2.UseSystemPasswordChar = False
        End If
    End Sub
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        TextBox1.Text = Generatorhash(TextBox2.Text)
        If TextBox2.Text.Length = Nothing Then
            TextBox1.Text = ""
            MessageBox.Show("Wpisz hasło do wygenerowania", "Pustę pole", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
        Else
            Button1.Enabled = False : TextBox2.Enabled = False : CheckBox1.Enabled = False
        End If
    End Sub
    Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
        Button1.Enabled = True : TextBox2.Enabled = True : TextBox1.Text = "" : TextBox2.Text = "" : CheckBox1.Enabled = True
    End Sub
    Private Function a() As Char()
        Throw New NotImplementedException
    End Function
End Class

Gdzie

 Private Function a() As Char()
        Throw New NotImplementedException
    End Function

Tworzy się jak nadusze Generuj i przy tym jest błąd NotImplementedException - this method or operation is not implemented.
oraz przy odpalaniu programu jest takie coś:

A first chance exeption of type 'System.NotImplementedException' occurred in WindowsApplication.exe

Prosze o pomoc :(

0

No przecież jak byk jest:

 Private Function a() As Char()
        Throw New NotImplementedException
    End Function

To przecież generuje ten wyjątek.

0

Ale nie chce działać

1

Bo ty nie masz pojęcia co robisz.
a zdaje się powinno zwracać tekst do zahashowania. Skąd ty masz ten kod?

0

Ref

Powie ktoś co tu jest źle?

1

Przeczytaj ze zrozumieniem to:

rivate Function a() As Char()
    Throw New NotImplementedException
End Function

Co to jest napisane w 2 linijce?! THROW (rzuć) new (nowy) NOT-IMPLEMENTED-EXCEPTION (wyjątek "nie zaimplementowano") !

Używasz tej funkcji, a ona nie jest zaimplementowana, brakuje Ci kodu.

dodanie znacznika <code class="vbnet"> - @furious programming

1 użytkowników online, w tym zalogowanych: 0, gości: 1