hi,

i have use below code to make sure the listview only contain 3 record n if more than 3 records to prompt error message and disable the NEXT TRANSACTION button. it works well. But the problem is when i delete 1 record out of 3 it suppose enable the NEXT TRANSACTION button but the button is still disable. whats wrong with my code...i code it at form Shown......Please guide me !!!
Thanx

If ListView1.Items.Count = 3 Then 
                Panel1.Enabled = False
                frmPopup.lblErrMsg.Text = GetButtonText("Only 3 transaction alloweded")
                frmPopup.YesNo = False
                frmPopup.QorEx = False
                frmPopup.ShowDialog()
            Else
                Panel1.Enabled = True
                'tmrShowTimeOutDlg.Enabled = False
                frmStep1_AgencyDirect.Show()
                Me.Close()
            End If

hi,

is there any one can guide on the problem that i'm facing now....please !!!!

What Event is your posted code in and are you calling that Event after removing a record?

hi,

how do i make it when user hit for 3rd transaction it will prompt a message as what in the code. this code goes well but i just wants to make sure its stop at the current form itself n not read the next line of code in the same block.

If ListView1.Items.Count = 2 Then
            Panel1.Enabled = False
            frmPopup.lblErrMsg.Text = GetButtonText("POS.Records")
            frmPopup.YesNo = False
            frmPopup.QorEx = False
            frmPopup.ShowDialog()
            End If

How are you adding items to the ListView?

Just add your code to disable the button right after the code of adding the new item. Should work if you start off with ListView.Items.Count = 0.

hi
thank you for your reply. the code below works perfectly whereby it stop once the list view reach more than 2 record n it disable the addmore button. i coded at addmore button. i just want to make sure that it suppose to stop there and not to go to the other line of code which is whithin the same block.
How do i stop that....

If ListView1.Items.Count = 2 Then
            Panel1.Enabled = False
            frmPopup.lblErrMsg.Text = GetButtonText("POS.Records")
            frmPopup.YesNo = False
            frmPopup.QorEx = False
            frmPopup.ShowDialog()
            End If

After the end if i dont want it goes to next line of code within the same block...
please help

Use "Exit Sub".

Here is a test sample.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer = 0
        If i = 0 Then
            i += 1
            MsgBox("i = 1")
        End If
        If i = 1 Then
            i += 1
   '//----------------
            Exit Sub
         '----------------\\
        End If
        If i = 2 Then
            MsgBox("i = 2")
        End If
    End Sub

hi

thank you its working perfectly

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.