Results 1 to 3 of 3

Thread: Text unchanged

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2009
    Posts
    1,058

    Text unchanged

    Hallo,

    I have a SelectedIndexChanged function, as shown below;
    vb.net Code:
    1. Private Sub CmbPayMethod_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbPayMethod.SelectedIndexChanged
    2.  
    3.         Call Oracleview()
    4.  
    5.     End Sub
    Call Oracleview Function as shown below:
    vb.net Code:
    1. Private Sub Oracleview()
    2.         'Open the database.
    3.         'Delete any existing record
    4.         Dim cmd As New SqlCommand
    5.         Dim conn As SqlConnection = GetDbConnection()
    6.  
    7.         'Dim a As Integer
    8.  
    9.         Try
    10.             Dim Oracle_num As New System.Data.SqlClient.SqlCommand(("SELECT Oracle_no FROM gprdsql.TblOracleNos WHERE Prac_no='" & _
    11.                             Me.TxtPracNo.Text & "' and Prac_eid = '" & _
    12.                             Me.TxtPracEid.Text & "'  and Pay_method = '" & _
    13.                             Me.CmbPayMethod.Text & "' "), conn)
    14.  
    15.             Using reader As System.Data.SqlClient.SqlDataReader = Oracle_num.ExecuteReader()
    16.  
    17.                 While reader.Read()
    18.  
    19.                     Dim Oracle_no As String = FixNull(reader.GetValue(0))
    20.  
    21.                     TxtOracleNo.Text = Oracle_no
    22.  
    23.                 End While
    24.  
    25.             End Using
    26.  
    27.         Catch ex As Exception
    28.             MsgBox(ex.Message, MsgBoxStyle.Information, "GCPM")
    29.         End Try
    30.        
    31.     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 as

    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
    Last edited by Hack; Apr 8th, 2009 at 06:07 AM. Reason: Added Highlight Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width