|
You need to make sure that the AutoCompleteSource property is set to AutoCompleteSource.CustomSource . You should be doing something like this:
AutoCompleteStringCollection a = new AutoCompleteStringCollection();
a.Add("test");
a.Add("test 2");
this.textBox1.AutoCompleteCustomSource = a;
this.textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Greetings!
I am currently trying to implement a small IPC Protocol for 2 of my applications.
Basically, one of them needs to know if the other one is running, and if yes, tell it some orders.
My current setup consists of 3 Main projects:
- IPC: Holds an interface IIPC with a couple of methods that have to be shared.
- MainForm: implements the interface IIPC and is supposed to be shared. Also "starts" the IPC Server.
- PluginDLL: is loaded into a 3rd-party app, and tries to talk to MainForm.
The usual setup consists of the 3rd-party app, which loaded PluginDLL. MainForm is supposed to be started by PluginDLL in case a function is requested.
But its also possible that MainForm is already running, and 3rd-party app is loaded after that. As MainForm exists, its supposed to be used rather than creating a new instance.
First problem there:
I've tried to find out whether MainForm is running by checking if the Channel is already registered:
[MainForm, "serverside"]
class MainForm : MarshalByRefObject, IIPC { ... };<br />
...<br />
Type t = typeof(MainForm);<br />
string ServerChannel = "serverMainForm";<br />
string ObjectName = "mfObject";<br />
...<br />
IpcServerChannel ipcChannel = new IpcServerChannel(ServerChannel);<br />
ChannelServices.RegisterChannel(ipcChannel,true);<br />
RemotingConfiguration.RegisterWellKnownServiceType(t, ObjectName, WellKnownObjectMode.Singleton);
[PluginDLL, "clientside"]
IIPC getIPCObject() {<br />
IpcClientChannel ipcChannel = new IpcClientChannel();<br />
ChannelServices.RegisterChannel(ipcChannel,true);<br />
IIPC ret = (IIPC)Activator.GetObject(typeof(IIPC), "ipc://" + ServerChannel + "/" + ObjectName);<br />
ChannelServices.UnregisterChannel(ipcChannel);<br />
try<br />
{<br />
if (ret.Equals(null)) return null;<br />
}<br />
catch<br />
{<br />
return null;<br />
}<br />
return ret;<br />
}
Unfortunately, GetChannel returned null, even tho I just registered the Channel before.
Enumerating ChannelServices.RegisteredChannels does not return anything inside PluginDLL, inside MainForm it does show the channel I just registered 2 lines before.
For that purpose, I had to use the exception that is thrown when accessing the proxy object with no serverobject behind.
This problem is worked around, but I'd like to know if theres a better way to check if I have an object behind the proxy, or either if the channel exists.
Second problem is the more serious one:
Using above Workaround, I managed to catch the circumstance that MainForm is not running, and run it in this case using System.Diagnostics.Process.Start() . After that, the code above generates a valid proxy - it seems.
But the call to ret.Equals(null) simply hangs, rather than returning false and retrieving the remote object OR failing and throwing an exception - it simply hangs, and wont respond. I also tried to use my own Method/Property/whatever back there instead of Equals, all of them simply hung.
So, what might be the reason for the Proxy object to hang when there is an object?
Or probably, is there any other way to communicate between 2 applications that does not need any additional stuff installed (like MSMQ), that isnt dependant on a port (Remoting with HTTP/TCP; its rather unlikely that a Channel with my programs ID exists already than an arbitrary port that may be used by other programs) or that depends on other lower level code (PostMessage with WM_COPYDATA, needs WinApi and other unmanaged stuff)
Regards, BhaaL
|
|
|
|
|
Hello, I have exactly the same problem. It seems that combination of IPC and Process.Start with RedirectStandardOutput is the problem. And only on Windows XP, it works in all other OS, which is very hard to debug then. Have you found a solution for this? I use RedirectStandardOutput to get message from Console App, that IPC channel is set up. I can certainly wait (say 2 seconds), but it is not a solution, but only a terrible workaround.
|
|
|
|
|
Nope, sorry, I didn't bother with it anymore.
I switched to WCF (using NamedPipes) later on, which is still in use today and works like a charm.
|
|
|
|
|
Hi,
Firstly, I realize I had posted a thread very recently regarding XML serialization, but I can't bump it and this is a different question
I need to serialize a whole data structure, and as it happens I have more than one reference to the same object in different parts of my code, i.e. (trying to think of a simplified example) Imagine a shop that keeps track of each customer's favorite item:
<br />
class Shop<br />
{<br />
Customer customer;<br />
Item[] inventoryList;<br />
<br />
<br />
}<br />
<br />
class Customer<br />
{<br />
Item favoriteItem;<br />
}<br />
When customer is initialised it will have a reference to an item in the inventorylist. As I understand it, the deserializer will generate a new instance of Item for the customer, or I can ignore it, in which case it will be null when I deserialize. Is there a simple solution to get it as a reference to the intended object? I realize that in this case I can just use an index in the array rather than a reference to store the favoriteItem, but this will require major refactoring of my code.
|
|
|
|
|
Hi Friends,
How to Programatically Convert the CSV format to Excel format(.xls) or Simple text format(.txt).
Note: I Have to do this Programatically, Not manully.
Any body have any Idea.
Thanks in advance.
Waiting for your reply.
Thanks & Regards,
Liyakhat.
|
|
|
|
|
CSV to txt is trivial, a csv IS a text file, you'd just be changing what's in it. .xls would require you to interop with Office, obviously.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christian,
First of thanks for the reply.
Can you tell me how to convert the CSV file to .xls format(How to interop with office)???
Thanks,
Liyakhat.
|
|
|
|
|
Hi.
In a few words, I have to convert a string retrieved from an Access database to a DateTime object.
I thought I'll use the Convert.ToDateTime() method. But there's the risk that the conversion will fail because the format will not be recognized. I think that this method uses the DateTime format taken from Contol Panel - Language Settings, so this would be tricky if the settings are different on another machine.
What would you do in this case?
Thanks.
|
|
|
|
|
I'd use TryParse to safly see if the conversion is possible. It'll also allow you to specify the format of the date:
System.DateTime.TryParse()[^]
|
|
|
|
|
DateTime.TryParse, but if it fails sometimes, then the other times, it's working because the day is < 13, and you're getting wrong dates.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Is it possible to retrieve the culture information for the machine running the application, and use that specific culture for the conversion?
|
|
|
|
|
I would store it in a culture neutral date format. Let the formatting of the date be taken care of on the client end where it belongs, and store the date using something like YYYY-MM-DD HH:MM:SS
|
|
|
|
|
Yes, but it shouldn't be stored as a string either.
|
|
|
|
|
For sure. But in this case it has to be this way.
|
|
|
|
|
anyone can plz tell me how to send SMS to a mobile phone from a .Net application.I am designing a deviceapplication.from the device i have to send sms to predefined mobile numbers
|
|
|
|
|
1. Open prefered browser.
2. Navigate to google (or prefered search engine).
3. search for c# sms.
4. come back when you have a problem other than laziness :P
C# sms[^]
|
|
|
|
|
There are several articles on codeproject showing how to do it. Why don't you use search?
|
|
|
|
|
Hi!
I recently completed a project which sends/receives SMS to mobile phone and i used an open source API called GsmComm http://www.scampers.org/steve/sms/. Try it, its very useful. But if you don't wanna use API then i guess you will have to do a lot of hard work.
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
Thanks for an interesting link
|
|
|
|
|
Wellcome
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
please i need help withy the code to implemnet cut,copy,pase and print funtions
|
|
|
|
|
1 - try a meaningful subject line next time
2 - what do you want to cut/copy/paste/print ?
You've not come close to giving us enough information to expect an answer, try reading the guide on how to ask meaningful questions.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'll make a deal with you -- you implement undo/redo in my program and I'll implement cut/copy/paste in yours.
|
|
|
|
|
Ooh Undo/Redo is pretty simple, just implement a Command design pattern with 2 methods on your Command interface
interface ICommand
void Undo()
void Redo()
Every action you want to perform then becomes a discreet Concrete Command object which implements whatever it wants as its undo/redo behaviour.
Whenever an action gets performed add it to a stack (undoStack). When undo is clicked pop the item off that stack, execute "Undo" and add it to another stack (redoStack). Whenever redo is clicked pop an item of the redoStack, execute "Redo" and add it to the undoStack.
Easy peasy.
|
|
|
|