Hi , i use enable choice function to enable or disable the ADD button for data grid.
now when i tried to use the code for update button its not working..
need to add cmdUpdateEntry.
here is the code..

Sub EnableChoice()
    ' disable to remove button
    ' check to see if every text field has contents.  If they all have
    ' contents (ie, they're not empty) enable the "Add Entry" button.
    If txtDate.Text <> "" _
    And txtCodeNo.Text <> "" _
    And txtDealerName.Text <> "" _
    And txtTruckNumber.Text <> "" _
    And txtProduct.Text <> "" _
    And txtQuantity.Text <> "" _
    And txtNetPrice.Text <> "" _
    And txtCommision.Text <> "" _
    And txtRent.Text <> "" _
    And txtLabour.Text <> "" _
    And txtReturnExpense.Text <> "" _
    And txtExpense2.Text <> "" _
    And txtStoreExpense.Text <> "" _
    And txtPhoneExpense.Text <> "" _
    And txtExpense3.Text <> "" _
    And txtTotalExpense.Text <> "" _
    And txtTotal.Text <> "" Then
        cmdAddEntry.Enabled = True
    Else
        cmdAddEntry.Enabled = False
    End If
    cmdRemoveEntry.Enabled = False

End Sub

Recommended Answers

All 3 Replies

On which event you are calling EnableChoice ?

what you mean about not working?

imean , i want update button disable as long as data in not entered, i want update button to be in disable state unless data is entered, ihope u understand what i ,mean.as for Add button condition to enable is ,
if all text box are filled Enable Add button
cmdAddEntry.Enabled = True
Else
cmdAddEntry.Enabled = False
End If
cmdRemoveEntry.Enabled = False
similarly i tried to update button but it is still in enable state.

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.