Click here to Skip to main content
16,016,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
DataClasses1DataContext db = new DataClasses1DataContext();
var drt = db.Franchises.Select(x => x.DistrubitorCompany).ToArray<String>()


AutoCompleteStringCollection acscName = new AutoCompleteStringCollection();
acscName.AddRange(drt);

txtDepositedTo.AutoCompleteCustomSource = acscName;
txtDepositedTo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txtDepositedTo.AutoCompleteSource = AutoCompleteSource.CustomSource;

#endregion Distrubitor Company

var drta = db.Deposites.Select(x => x.DepositeName).ToArray<String>();

AutoCompleteStringCollection acscDepositeName = new AutoCompleteStringCollection();

acscDepositeName.AddRange(drta);

txtDepositedTo.AutoCompleteCustomSource = acscDepositeName;
txtDepositedTo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txtDepositedTo.AutoCompleteSource = AutoCompleteSource.CustomSource;



I am only getting the last source in output, but I want from it both.
What am I doing wrong here?
Posted
Updated 12-Jun-12 5:24am
v2

1 solution

Why not add both sources to the same AutoCompleteStringCollection then:
C#
DataClasses1DataContext db = new DataClasses1DataContext();
var drt = db.Franchises.Select(x => x.DistrubitorCompany).ToArray<string>()
AutoCompleteStringCollection acscName = new AutoCompleteStringCollection();
// Add this source to the auto completer
acscName.AddRange(drt);

#endregion Distrubitor Company

var drta = db.Deposites.Select(x => x.DepositeName).ToArray<string>();
// Add the second source to the same autocompleter instance
acscName.AddRange(drta);

txtDepositedTo.AutoCompleteCustomSource = acscName;
txtDepositedTo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txtDepositedTo.AutoCompleteSource = AutoCompleteSource.CustomSource;


Regards,

Manfred
 
Share this answer
 
v2
Comments
jinenk 12-Jun-12 11:34am    
still not getting o/p ...it gives compile time error.!!
Manfred Rudolf Bihy 12-Jun-12 15:29pm    
Well would you mind telling us which error you are getting?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900