Autocomplete Textbox in Dynamics SL
As Dynamics SL User, We always choose F3 or right Double click for the PV Lookup to select the specific data of any control in Dynamics SL. This PV Lookup functionality is very helpful to find the specific data on PV Lookup itself. We can also have search option by clicking the Header of PV Lookup to find specific data as user wants.
Now I have tried something different on my Custom Screen in Dynamics SL. I have used the Dot net Text box control to achieve the PV functionality using the Autocompletemode & Autocompletesource properties. These Textbox properties made the search operation very simpler and easy to select the specific data on my custom screen. Here no need to hit the F3 or right double clicks on Dynamics SL custom screen. You have to type the Character as your wish on textbox control and just displays the all the data which are specific to the typed character on Textbox control.
Please follow the below steps to achieve this Autocomplete functionality on Dynamics SL
- Include the Textbox (Dot Net control) from Tool box.
- Change the Autocompletemode property as “Suggest”
- Change the Autocompletesource proper as “CustomSource”
- Include the below code in custom screen of Dynamics SL.
Public Sub AutoCompletePV(ByVal table As String,ByVal txt As Object)
Dim SQlStr As String
Dim Csr_temp As Integer
txt.AutoCompleteCustomSource.Clear()
SQlStr = “Select * from “ & table
serr1 = SqlFetch1(Csr_temp, SQlStr, btable)
While serr1 <> NOTFOUND
txt.AutoCompleteCustomSource.Add(Trim(btable.fieldname))
serr1 = SFetch1(Csr_temp, btable)
End While
Call SqlFree(Csr_temp)
End Sub
For instance if you want to include this autocomplete functionality on Project Id field of custom screen, here btable should be the bPJPROJ & field name should be the Project.
- Call this functionality in Form1_load
AutoCompletePV (“tablename”, TextBoxname)
This functionality is only for custom screen of Dynamics SL. I am working on the same functionality in standard screen customization.
This was originally posted here.
*This post is locked for comments