|
All the auto complete functions of a combo box can be set in the designer. If you need to do it through code - this should get you started. (I've commented it for you but it should be very obvious what's happenning even without the comments)
AutoCompleteStringCollection myAutoCompleteCollection = new AutoCompleteStringCollection();
myAutoCompleteCollection.Add("Test entry 1");
myAutoCompleteCollection.Add("Test entry 2");
ComboBox myComboBox = new ComboBox();
myComboBox.AutoCompleteMode = AutoCompleteMode.Suggest;
myComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
myComboBox.AutoCompleteCustomSource = myAutoCompleteCollection;
myComboBox.Location = new Point(13, 13);
myComboBox.Size = new Size(121, 21);
this.Controls.Add(myComboBox);
Dave
|
|
|
|
|
I'm sorry but I'm a really newbie
First of all I want to be able to add the special combobox from the designer
In my project
1- I have a form (form.cs)
2- I have the designer of that formForm.Designer.cs
3- I have added the source of Matt.Berther.Control for special combobox CodeFile1.cs
4- I have added the using Matt.Betrther.Control directive in my project
NOW !
How can I visualy add an autocomplete combobox into my form
Is it possible or do I have to define everything the code editor it is not realy practicall to ajust size and position that way and I never did it for any control !
|
|
|
|
|
Ahhh - you didn't say you were using a custom control and not the standard combo box!
Have you got a link to where you got this from?
Dave
|
|
|
|
|
|
Omit any of these steps if you've already done them!
1. Right click your project in solution explorer and chose Add|Existing Item.
2. Browse to AutoCompleteComboBox.cs and click Add.
3. Hit F5 to run your project.
4. In Design view, open the toolbox and you'll find a new entry 'AutoCompleteComboBox' at the top.
5. Use like any other control.
Dave
|
|
|
|
|
Hello
Thans a lot !
I don't know how I miss it (it was probably too high in the toolbox) !!
However I will now inspect the code because it does'nt react as I expect but exactly as a standard CB for now
You assistence is Great !!
|
|
|
|
|
Hi, i use
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
to print something to printer.
there's a small dialog box appear for a second saying the
document file name with a 'Cancel' button. I think is not
PrintDocument doing this, but Windows.
Somebody know how i can hide this dialog??
or
Someone know other print command than 'PrintDocument'
that i can use to prevent showing this dialog???
|
|
|
|
|
Hi
go to this link it will help you
Click Here
Yogesh Agarwal
|
|
|
|
|
I have a text box with a URL in in.
How do I get my application to recognize the URL and open the corresponding webpage when it is clicked?
Here is what I am putting in the text box:
<code>txtAbout.Text = "Developed by Teboweb.Com 2008" + Environment.NewLine + Environment.NewLine +
"Be sure to check www.teboweb.com/firstofficernews.html for news on updates etc."</code>
I realize this is very much a beginners question and I have googled but to no avail.
You always pass failure on the way to success.
|
|
|
|
|
Use richtextbox control instead of textbox ans set DetectUrls property to true. You can also use LinkLabel class for displaying urls
|
|
|
|
|
Thank you Giorgi.
You always pass failure on the way to success.
|
|
|
|
|
what type of text box are you using?
- System.Windows.Forms.TextBox
- System.Windows.Forms.MaskedTextBox
- System.Windows.Forms.RichTextBox
|
|
|
|
|
SpacixOne wrote: 1. System.Windows.Forms.TextBox
Giorgi has provided a solution for me - thanks for asking.
You always pass failure on the way to success.
|
|
|
|
|
Hi guys,
I am trying to update an old application that was designed by another programmer. I am not very sharp at C# and need your help.
Can you please help me understand the following code that is in the windows service
IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr);
IPAddress ipAddress = hostEntry.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort);
m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
m_svSocket.Bind(ipEndPoint);
m_svSocket.Listen(10);
while(true)
{
Socket rtSocket=m_svSocket.Accept();
if(rtSocket.Connected)
{
TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest);
TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket);
}
}
ProcessClientRequest has a bunch of functions called like getschedule from database etc. I am trying to force Processclientrequest to reload the schedule from the database without restarting the service.
Please help.
Sameer
|
|
|
|
|
Wow, looks more like a coding horror to me...
People run that code on their PC??
|
|
|
|
|
no the service is installed on the server. It has run and currently runs great with no problems. What do you mean by coding horror? Also, the attached code is called by the timer. Here is the full function.
private void StartTimerAndServerSocket()
{
Writ2ErrLog("Service Timer Initialized");
string sErr="Application is ready for processing";
try
{
Writ2ErrLog(sErr);
m_tMonitor = new TD.Timer(new TD.TimerCallback(MonitorFunc),1, 0,45000);//45 sec
if(m_sServerAddr==string.Empty)
{
m_sServerAddr=Dns.GetHostName();
}
if(m_nPort==-1)
{
m_nPort=1024;
}
IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr);
IPAddress ipAddress = hostEntry.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort);
m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
m_svSocket.Bind(ipEndPoint);
m_svSocket.Listen(10);
while(true)
{
Socket rtSocket=m_svSocket.Accept();
if(rtSocket.Connected)
{
TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest);
TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket);
}
}
}
catch(Exception ex)
{
m_svSocket.Close();
m_tMonitor.Dispose();
sErr="Start Error " + ex.Message;
}
finally
{
if(sErr!=string.Empty)
{
Debug.WriteLine(sErr);
Writ2ErrLog(sErr);
}
}
Sameer
|
|
|
|
|
I have a class with three properties and i override the ToString method to return a concat of them.
now i'd like to have a textbox with a customsource foe the auto complete but i'd like to be able to type any one of the properties and show the relevant ToString output.
IE.
Item1.p1 = "Johnson"; Item1.p2="Chuck"; Item1.p3=50;
Item2.p1 = "Johnson"; Item2.p2="Michelle"; Item2.p3=20;
Item3.p1 = "Johnson"; Item3.p2="Joe"; Item3.p3=15;
Item4.p1 = "Joe"; Item3.p2="Black"; Item4.p3=10;
Item.ToString(){
return string.format("{0},{1}-{2}",p1,p2,p3);
}
now if you type John in the textbox id like to autocomplete to show (p1.tostring,p2.tostring and p3.tostring)
if you type "Joe" the drop down should have (p3.string and p4.tostring)
Any ideas?
|
|
|
|
|
cechode wrote: now if you type John in the textbox id like to autocomplete to show (p1.tostring,p2.tostring and p3.tostring)
Since John doesn't match your example, the autocomplete shouldn't work at all.
You would have compare each item to find a match anywhere in the string. Not very reliable since you will undoubtedly have duplicates.
only two letters away from being an asset
|
|
|
|
|
i dont have any duplicates in the list (a dup would be two items with both p1 and p2 equal).
essentially i'd like you to be able to type any value from any of the two properties (p1 or p2) but have the autocomplete (suggest) show you the Tostring of the object not what you type. ( real world example makes more sense )
|
|
|
|
|
You already have the answer, compare each item with a contains
only two letters away from being an asset
|
|
|
|
|
it's an answer but not to the current question.
thx for even reading it
|
|
|
|
|
Then what is the question? Be a little more specific, we aren't mind readers here.
only two letters away from being an asset
|
|
|
|
|
I think you're gonna have to create two auto complete sources and switch between them based on your criteria.
Dave
|
|
|
|
|
If I have a data file with a specific extension, and I register this extension to a C# executable. How can the program load the data file? I.e., I want to start the executable by double-clicking on an appropriate data file, and have the executable load that data file.
Thanks,
Tom
|
|
|
|
|
The name of the file is send as argument to the application. The args parameter of the main method is populated with the arguments that is sent to the application.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|