Hallo,
I have a SelectedIndexChanged function, as shown below;
Call Oracleview Function as shown below:vb.net Code:
Private Sub CmbPayMethod_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbPayMethod.SelectedIndexChanged Call Oracleview() End Sub
What I want to do is that, if the text in textbox TxtOracleNo is the same after IndexChange, i.e., a user changes from BACS to Cheque and vice versa and the Text in TxtOracleNo has not changed meaning it doesn't exit, then a message box is prompted asvb.net Code:
Private Sub Oracleview() 'Open the database. 'Delete any existing record Dim cmd As New SqlCommand Dim conn As SqlConnection = GetDbConnection() 'Dim a As Integer Try Dim Oracle_num As New System.Data.SqlClient.SqlCommand(("SELECT Oracle_no FROM gprdsql.TblOracleNos WHERE Prac_no='" & _ Me.TxtPracNo.Text & "' and Prac_eid = '" & _ Me.TxtPracEid.Text & "' and Pay_method = '" & _ Me.CmbPayMethod.Text & "' "), conn) Using reader As System.Data.SqlClient.SqlDataReader = Oracle_num.ExecuteReader() While reader.Read() Dim Oracle_no As String = FixNull(reader.GetValue(0)) TxtOracleNo.Text = Oracle_no End While End Using Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Information, "GCPM") End Try End Sub
MsgBox ("Enter new Oracle number").
Also, it will be nice if TxtOracleNo textbox will be empty if oracle_no is not present in TblOracleNos. Presently, if it is not available it retains the previous value.
Thanks




Reply With Quote