Sir,

My problem with my project so please help me about I am enclosing my project with problem very simple but I can't found. I am using text box and listbox last two textbox i.e. txtlani and maskedtextbox.

Now the problem is when the user put the data into above mentioned two text boxes for the selected item of the list box I want to change the back color and If the user wish to leave blank that two text boxes then no change at all in the list box selected item.

In short that if Textbox leave blank then no change in the selected item back color if in the Textbox have some value than selected item back color change.

In short I need to keep record whether the member has been paid or not.

In any other suggestion how to keep record whether members have paid or not please guide.

Please help me.


Thanks.

Sir,
I am using following code while inserting and update the data into

Private Sub Addmembers()
        Try
            Dim cmd As OleDbCommand
            Dim con As OleDbConnection
            con = New OleDbConnection(connectionString)
            cmd = New OleDbCommand(Add_members, con)
          
           cmd.Parameters.AddWithValue("@Lani_First Name", txtfirst.Text)
            cmd.Parameters.AddWithValue("@Lani_Middle Name", txtmiddle.Text)
            cmd.Parameters.AddWithValue("@Lani_Last Name", txtlast.Text)
            cmd.Parameters.AddWithValue("@Lani_Company Name", txtcomp.Text)
           
            If IsNumeric(txtlani.Text = "") = False Then
                cmd.Parameters.AddWithValue("@Lani_Lani Rs", DBNull.Value)
                lblani.BackColor = Color.White
            Else
                cmd.Parameters.AddWithValue("@Lani_Lani Rs", txtlani.Text)
                lblani.BackColor = Color.Blue
            End If



            If IsNumeric(MaskedTextBox1.Text = "") = False Then
                cmd.Parameters.AddWithValue("@Lani_Date", DBNull.Value)
                lblani.BackColor = Color.White
            Else
                cmd.Parameters.AddWithValue("@Lani_Date", MaskedTextBox1.Text)
                lblani.BackColor = Color.Blue
            End If



           
          
           
                     con.Open()
                       cmd.ExecuteNonQuery()
            con.Close()
            ' Close and Clean up objects

          
            con.Dispose()
            cmd.Dispose()



        Catch ex As OleDbException
            MsgBox(ex.Message.ToString)
            'insertOk = False
        End Try
    End Sub
Private Sub updateinfo()

        Dim con As OleDbConnection
        Dim cmd As OleDbCommand
        Try
            

            con = New OleDbConnection(connectionString)
        

                                   
            cmd = New OleDbCommand("UPDATE [Lani] SET [First Name] = @fname, [Middle Name] = @mname, [Last Name] = @lname,[Company Name] = @cname, [Lani Rs] = @rs,[Date] = @ldate WHERE [Sr No] = @srno", con)
            cmd.Parameters.AddWithValue("@fname", txtfirst.Text)
            cmd.Parameters.AddWithValue("@mname", txtmiddle.Text)
            cmd.Parameters.AddWithValue("@lname", txtlast.Text)
            cmd.Parameters.AddWithValue("@cname", txtcomp.Text)
            If IsNumeric(txtlani.Text = "") = False Then
                cmd.Parameters.AddWithValue("@Lani_Lani Rs", DBNull.Value)
                lblani.BackColor = Color.White
            Else
                cmd.Parameters.AddWithValue("@Lani_Lani Rs", txtlani.Text)
                lblani.BackColor = Color.Blue
            End If

            If IsNumeric(MaskedTextBox1.Text = "") = False Then
                cmd.Parameters.AddWithValue("@Lani_Date", DBNull.Value)
                lblani.BackColor = Color.White
            Else
                cmd.Parameters.AddWithValue("@Lani_Date", MaskedTextBox1.Text)
                lblani.BackColor = Color.Blue
            End If

            cmd.Parameters.AddWithValue("@srno", txtid.Text)

            con.Open()

            'cmd = New OleDbCommand(strupdate, con)
            cmd.ExecuteNonQuery()

            ' Close and Clean up objects
            con.Close()
            cmd.Dispose()
            con.Dispose()

        Catch ex As Exception
            MsgBox(ex.Message.ToString)
            'updateOK = False
        End Try
            

    End Sub

It does't change the color while inserting and updating the data

Please help me

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.