|
While you could use ShAutoComplete From the Shell API it will only AutoComplete URLs. If you want it to autocomplete the Items in a combobox you would have to do a lot of nasty COM interop.
However, I am in the middle of developing a .NET ComboBox that features autocomplete so I already have some code you can have to do this in an inherited combobox. Just use it as you would a regular combobox. Enjoy
using System;
using System.Windows.Forms;
namespace YourNameSpace
{
public class ACComboBox : ComboBox
{
protected string oldText = "";
protected override void OnKeyPress(KeyPressEventArgs e)
{
if(!Char.IsControl(e.KeyChar))
{
int possibleMatch=0;
string textBefore = Text;
possibleMatch = FindString(Text);
if(possibleMatch >= 0)
{
oldText = Text;
SelectedIndex = possibleMatch;
Select(textBefore.Length,Text.Length-textBefore.Length);
}
}
base.OnKeyPress(e);
}
protected override void OnTextChanged(EventArgs e)
{
oldText = Text;
base.OnTextChanged(e);
}
}
}
|
|
|
|
|
|
Here's some quick code: (similar to previous reply)
private void comboBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
int where = comboBox.FindString(comboBox.Text);
int start = comboBox.Text.Length;
if ((where >= 0) && (e.KeyChar >= 32))
{
comboBox.Text = ((string) comboBox.Items[where]);
comboBox.Select(start, comboBox.Text.Length);
}
}
Nice, quick.
PS: How the hell do i get code nicely displayed like some other posts i have seen?
|
|
|
|
|
leppie wrote:
PS: How the hell do i get code nicely displayed like some other posts i have seen?
Put the code within PRE tags
This is within pre tags
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
I am getting ready to build a webservice that will comprise several components. Am I better off building several components with one webservice as an abstraction layer or several smaller webservices.
Steve
Not all who wander are lost...
|
|
|
|
|
Hi Steve
This sounds like an interesting problem.
Please can you provide some more info so I can give you a better answer.
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
I am beginning a research project in which I will begin to develop an application to manage a small to mid-size hospital. I am wondering what the best way to architect this is. I was thinking of building a webservice for consumption by and ASP.NET site as well as a piece of software on handheld devieces. There is so much functionality that will be exposed that roling it into a single webservice will produce an enourmous service. I was thinking after I posted that COM+ may be the way to go. I have no experiance developing enterprise applications so any advice or good resources would be appreciated.
Thanks.
Steve
Not all who wander are lost...
|
|
|
|
|
OK. Here's my take on the web services architecture thing.
All a web service (ws) really is, is a class that happens to be exposed to the web. Ideally, in my opinion, the ws should just wrap an existing class. So, ws X would wrap (and expose) class X.
My reasoning behind this is because of 2 primary factors: performance and reusability.
Performance - if ws X is the sole provider of functionality X then another class on the same machine will have to take the performance hit of calling a ws (marshalling, HTTP, address resolution, etc...).
Reusability - follows on from previous point. Also, I view a ws to be a requirement of a class and not necessary a point of functionality itself.
The thing to remember is that a ws is just a class. So, if your class/ws is too large, then chances are that it hasn't been factorised properly. One school of thought (Bruce Eckell, I think) is to design your class on a small flash card. The premise being that if you require more physical space on the card to jot down member and attribute names then you should use another card/class. I think this is a pretty nice idea! Thanks, Bruce.
An idea would be to remove the concept of web services from your initial design and rather give a special attribute to the classes that need to be exposed to the web/intranet. This can later be enhanced into a decorator class of soughts.
Your idea of having ASP.NET as your front end that consumes web services is a valid design. What would the reason be to expose web services though?
If your reason is to expose a subset of functionality for other apps to use, then cool.
The architecture I'm working on at the moment uses ASP.NET pages (very light) that consume ws as per your idea. There was a very specific reason for it though. The entire backend (ws included) will be migrated to a J2EE & ws system in a few years time and we wanted to prevent a[nother] rewrite for that.
As far as COM+ is concerned: COM+/MTS no longer gives you the reduction in object creation time that it would do for pure COM components, so that's minus 1 point. Hopefully, this will change with COM+ 2 (?) in the .NET servers.
The reasons that COM+ might be useful in a .NET world is for things like transactions. Will this be a requirement for your application?
If you are keen to continue this offline, then either MSN Messenger/mail me at simon_stewart@hotmail.com.
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
I am trying to execute a batch file from .NET using C# but it is not working correctly. I can execute other batch files fine but I am having problems with just this one. I can execute the batch file without any problems manually through the command window. I can even execute it using the Windows schedular without any issues. I suspect permission issues, but I have no idea what to do about it. Any information will be greatly appreciated.
Thanks,
Aisha
|
|
|
|
|
I would appreciate any help on how to take a MIME encoded (I assume it is MIME encoded) string representing an Excel email attachment and write it out to a binary XLS (Excel file format, not the XML XLS thing) file.
I used the BinaryWriter but just ended up with a binary file full of normal characters. I assume I need to decode the MIME part or something.
Of course if you know how to connect to a POP3 server and save an emails attachment without all this fuss I would appreciate that even more.
thanks guys.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Brian Delahunty wrote:
one of my boys on the inside instead of the outside
benjymous wrote:
All the male CP inhabitants cross their legs in unison
|
|
|
|
|
Check out Base64 in System.Cryptography (I think thats what its called...)
you'll get an array of bytes which will be the original file. all you have to do is then stream that out to your file and name it right.
// Rock
|
|
|
|
|
CLaW wrote:
Check out Base64 in System.Cryptography
Thanks CLaW, will give it a bash.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Brian Delahunty wrote:
one of my boys on the inside instead of the outside
benjymous wrote:
All the male CP inhabitants cross their legs in unison
|
|
|
|
|
Paul
If you want to create a file readable by Excel, I suggest that you create a CSV file. Then you can open it in Excel and save as XLS. The XLS format is too complicated to generate via code unless you have some kinda API for doing that
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Hey, I've got a quick question about a quirk with the dotnet SDK that I'm seeing on my machine here at work. I just want to know if anyone has seen/heard of it....
It seems that performance even for console apps is abysmal. The canonical 'Hello, World' takes between 5-10 seconds to run (!). I just figured the performance was bad because I'm running a PII 350 here at work, but I noticed the CPU didn't go nuts and memory consumption didn't go up, so it appeared to be waiting for something.
I poked around on USENET and some people had seen the same thing. Someone said they had the same problem just when they were connected to their LAN, otherwise they were OK. I tried unplugging my box and performance was great, almost instant for the Hello World app. Another person said to add a local user to your box called ASPNET. (?) I tried this and this seemed to fix the problem also.
Has anyone heard of this? Do you know if there is a KB article or anything from MS regarding it?
|
|
|
|
|
I've heard this as well... but never witnessed it.
I don't remember hearing anything specific from MS on the issue, tho I believe that they are looking into it.
very strange bug indeed.
|
|
|
|
|
Windows operating system's file name is not case-sensitive.
I have a directory which path is "C:\Test\SubDirectory",
but now i can only get the string "c:\test\subdirectory",
i want to get its origial path.
so i use the following code:
DirectoryInfo dir = new DirectoryInfo("c:\test"); \\i get this string from "c:\test\subdirectory"
DirectoryInfo[] dirInfo = dir.GetDirectories();
foreach(DirectoryInfo temp in dirInfo)
{ //but the temp.FullName are all begian with string "c:\test" .
// what i want to get is "C:\Test"
.....
}
because i can't get right result.
I change my code as following:
DirectoryInfo dir = new DirectoryInfo("C:\");//i just can be sure of the driver name in uppercase
DirectoryInfo[] dirInfo=dir.GetDirectories();
foreach(DirectoryInfo temp in dirInfo)
{
.....//i can get string "C:\Test\SubDirectory " after i get String "C:\Test"
}
I find out that service DirectoryInfo.GetDirectories() just add file name after its object's attribute named "FullName" .
If the object's "FullName" is not case-sensitive. I can't get subdirectories' right path use service GetDirectories();
To get the right path, i had to extract subdirectory begin with Driver.It's not a efficient way.Who can give me some efficient way?
|
|
|
|
|
Yes, I see what you mean....
Here's a nice way to trick it into forcing the FS supplied name instead of yours:
DirectoryInfo dir = new DirectoryInfo(new DirectoryInfo("c:\\test").GetDirectories(".")[0].FullName);
MessageBox.Show(dir.FullName);
|
|
|
|
|
How to use DirectShow with C# ?
Does anybody know ?
Thanks
|
|
|
|
|
This want work. cunsharp does not support dx or any nondotnet stuff. Isnt it stupid - yes it is.
~~~VBABE~~~
|
|
|
|
|
|
DirectX is a COM based library so you should be able to use it with .NET and the interop layer.
|
|
|
|
|
Agreed.
I did hear that there will be a DirectX.NET edition coming out sometime too. Not sure when though.
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
I have tried to find out how to do frame grabbing (DirectShow ) from a webcam, but it seems to be a bit tricky. I can not find any useful hint somewhere
|
|
|
|
|
|
I create a default webservice in vs.net, when i press "run", it will invoke ie to open the asmx file, but the ie always wants me to download instead of open as a webservice!
Thank you for your help!!!!
I'm amumu, and you?
|
|
|
|