|
-
Apr 8th, 2009, 06:02 AM
#1
Thread Starter
Frenzied Member
Text unchanged
Hallo,
I have a SelectedIndexChanged 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
Call Oracleview Function as shown below:
vb.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
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
-
Apr 8th, 2009, 06:56 AM
#2
Hyperactive Member
Re: Text unchanged
hey
vb Code:
Dim Oracle_no As String = FixNull(reader.GetValue(0)) TxtOracleNo.Text = Oracle_no
modify FixNULL Function and return string.empty when reader has null
and set focus in textbox then show messagebox for entering data
* If my post helped you, please Rate it
* If your problem is solved please also mark the thread resolved it is there in right top of page under thread tools
* Why Rating is useful
-
Apr 8th, 2009, 08:12 AM
#3
Thread Starter
Frenzied Member
Re: Text unchanged
please could you tell me the code.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|