need help fix this

dualshock03

Well-known member
Joined
Jan 28, 2007
Messages
105
Programming Experience
1-3
its seems my combobox event doesnt work.. see DELETE SETTINGS FUNCTION

when i type a string on the textbox txtadmin_delete.Text it deletes the inputed data from the database.. but if i choose to delete the data using the combobox: ComboDeleteType.SelectedItem, its going null and still executes the message "User is Terminated!!" which is for DELETE_CHANGES() function query..


here's my code:

VB.NET:
Function verify5_combadmin() As Boolean
        If ComboDeleteType.SelectedItem <> Nothing And txtadmin_delete.Text = "" Then
            txtadmin_delete.Focus()
            Return True
        Else : Return False
        End If
    End Function

    Function verify4_txtadmin() As Boolean
        If txtadmin_delete.Text.ToString = txtdelcon.Text.ToString And no_delete() = False Then
            txtadmin_delete.Focus()
            Return True
        Else : Return False
        End If
    End Function

 Private Sub txtadmin_delete_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtadmin_delete.TextChanged
        ComboDeleteType.SelectedItem = Nothing
        con1.Open()
        Try
            Dim comtest1 As New MySql.Data.MySqlClient.MySqlCommand("Select * from tblusers WHERE clerk_user =  '" & txtadmin_delete.Text & "'", con1)
            delete_adminreader = comtest1.ExecuteReader
            While delete_adminreader.Read
                txtdelcon.Text = delete_adminreader("clerk_user")
            End While
            con1.Close()
        Catch SQL_err As MySql.Data.MySqlClient.MySqlException
            MsgBox("error reading occured ;" & SQL_err.Message)
        End Try

 Public Sub DELETE_SETTINGS()

        If verify4_txtadmin() = True Then
            DELETE_CHANGES()
            MsgBox("User is Terminated!!", MsgBoxStyle.Information)
            clear_deleteuser_combdelete()
        ElseIf no_delete() = True Then
            MsgBox("Input Proper Entries", MsgBoxStyle.Exclamation)
        ElseIf verify5_combadmin() = True Then
            DELETE_CHANGES1()
            MsgBox("All Selected Users are Terminated!!", MsgBoxStyle.Information)
            clear_deleteuser_combdelete()
        Else
            MsgBox("Unacceptable entry")
            clear_deleteuser_combdelete()
            txtadmin_delete.Focus()
        End If

  Private Sub SAVE_SET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_SET.Click
        If  teleport_controller = 3 Then
            DELETE_SETTINGS()
        End If

Private Sub btn_admin_del_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_admin_del.Click
        delete_controls_enabled()
        teleport_controller = 3
 
Back
Top