Raam_kimi

Hi

I got a problem implementing AutoSuggest in Win Forms TextBox control. This is the code i have written. It doesnt throw any error.

Dim values As New AutoCompleteStringCollection

If Not suggestResult Is Nothing Then

If suggestResult.Length > 0 Then

For i = 0 To suggestResult.Length - 1

'values.Add(suggestResult(i))

Next

txtKeyValue.AutoCompleteCustomSource = values

xtKeyValue.AutoCompleteSource = AutoCompleteSource.CustomSource

txtKeyValue.AutoCompleteMode = AutoCompleteMode.Suggest

End If

End If

Any help would really appreciated. Thanks guys...




Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Can Bilgin

Why dont you try AutoCompleCustomeSource.AddRange(suggestResult);



Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Oleh Svintsitskyy

Hi Raam_kimi,

Code string where AutoCompleteStringCollection is populated is commented.

Code Block

'values.Add(suggestResult(i))

Uncomment it. I tried Your code - it works.

Regards,

Oleh.





Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Raam_kimi

Thanks for ur reply Bilgin,

however both are same.. i tried that too, not working Sad






Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Raam_kimi

Hi Oleh,

I think its typo when i post in forum.. but thats not actually commented in my workin code.. Anyway thanks Oleh






Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Oleh Svintsitskyy

Raam_kimi,

If autocomplete values collection is filled with correct values check TextBox.Multiline property if it's false AutoComplete won't work(see remarks)


Regards,

Oleh.





Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Can Bilgin

Isnt it otherway round I thought when it is set to multiline, the autocomplete wouldnt work...




Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

nobugz

It works fine after I remove the comment before values.Add().





Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Raam_kimi

Thanks guys for ur replies,

i wanna clear few things first, its multilne enabled textbox... And I did this code nor in the form load event neither while creating the text box control.

could it be possible to add the auto suggest at any point of running time,. coz there is some existing data avail in the text box when i load the textbox with the suggest results. does it cause any impact..

But I have added some suggest collections in design time, this time it works fine. But i cant be able to do this is program..






Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Can Bilgin

Again: "AutoCompleteSource does not work on multiline TextBox controls. " This is from the TextBox.Multiline property as Oleh suggested. Smile





Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Oleh Svintsitskyy

Raam_kimi,

You can update AutoCompleteCustomSource collection at arbitrary point in time.It won't affect TextBox text. But AutoComplete feature won't work with Multiline textbox.

Regards,

Oleh.





Re: Windows Forms General problem Loading AutoSuggest in TeXtBox

Raam_kimi

ohoooooo.......... I Got it, it works fine now

Thanks Guys for ur help.... these small mistakes always killing me..............