|
Hi all,
I'm trying to copy a feature thats in Outlook. In the To field when creating a new email, if you type in an email address that you have used before, it will automatically display it and allow you to press enter.
Once you have done this, if you click on the email address, it selects it as a block and not as a piece of text. If you double click on it, it shows you information on that email address.
I am building an application for internal requests and would like the user to be able to type in the User's name in which the request is for, and on leaving the textbox, it will check the typed in User's Name and if it matches then it does what I described above, turns into an object and when you double click on it, it will show that users information.
I've played around with a Rich Text Box, and i've managed to get it to underline all the User's Names that are correct, but if I click on it, it will act as if its text (of course) and if the user continues typing it remains underlined.
Any idea's?
TIA
Gav
|
|
|
|
|
|
Well, I've been wrestling with a problem for a little while now and feel like I'm banging my head against a brick wall. Basically, I want to be able to generate code from a string that can refer to a current instance member. This would mean that I would need to be able to inject it into the current instance.
Specifically I'm trying to attach the code to an attribute. Initially I attempted to do this with a delegate, but you can't attach delegates to attributes (which makes sense when you stop and think about it).
Consider this example:
SomeClass.Generate("return (this.Name != null && this.Name.Length.Trim() < 20);"); I've looked at the CodeDOM and I've looked at Reflection.Emit and I can't seem to find a way to do this.
If anybody else has attempted this, I would be really interested to hear how they managed it or if (as I'm starting to suspect) this is impossible.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You're gonna have a hard time doing this without expression trees, I think. The code compiler in CodeDOM won't work because the code you posted there won't compile (this.Name is unknown).
I suspect you're doing this for some kind of argument validation, in combination with some verification/static analysis tool? If so, you might want to check out Spec#[^]. They've got a C#-compatible mode where you can type verification using special comments, then verify this with their Boogie tool.
|
|
|
|
|
You're right about what I'm trying to achieve. There were various options for what I want to do, but I really want to put this in the attribute. Oh well.
The research on spec# is interesting though.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yeah, it's a shame attributes can't have non-compile time values. I recently hit this problem[^] with MbUnit test framework for argument validation tests.
I've thought about this problem as well regarding argument validation in your real code (as opposed to just unit testing); seems it's pretty impossible to do currently, outside of boil-the-ocean schemes like aspect-oriented programming's method call interceptions. What we need is language extensions for specifying pre- and post-conditions, ala Eiffel[^]. Spec# does this by adding some new keywords to C#, such as ensures and requires . However, if you can't make the Spec# plunge, you can simply add special comments to your C# code, then run their static analysis tool on your C# code to make sure the contracts are enforced.
I'm looking forward to C# 4. Then we should have some good support[^] for pre- and post- conditions, pure methods, immutable types, non-null types, and invariants, alleviating the need for things like validation in attribute strings. Hopefully they throw in some good multi-threading abstractions too.
I'm wondering if LINQ could do anything in the form of expression trees to help us out here with some kind of Linq To Validation[^].
|
|
|
|
|
Well, to turn a string containing C# code into IL, you obviously need a C# compiler. As the Microsoft C# compiler only compiles full assemblies, you cannot use it for light-weight code generation, especially if you want "this" to mean something else.
You could write your own C#-like compiler by using a C# parser like NRefactory[^], then converting from the parser's AST to CodeDOM (NRefactory contains a class that can do this conversion for a limited number of cases, it is used in SharpDevelop's form designer to load InitializeComponents() contents into a CodeDOM statement list), and letting CodeDOM compile it.
|
|
|
|
|
Thanks for the information. I'll take a look into this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
How to Produce a menu-driven application that uses accept statements and variables.
And also tell me what is accept statement and veriables
|
|
|
|
|
Looking at your message history, all of your message titles are please or urgent. Please read the forum guidelines and name posts appropriately.
This message is very vague. If you google what you are looking for, read about it, come back and ask a more specific question.
__________________
Bob is my homeboy.
|
|
|
|
|
|
IrfanHaleem wrote: How to Produce a menu-driven application that uses accept statements and variables.
And also tell me what is accept statement and veriables
So, let me get this straight. You want to create an application using techniques that you know nothing about? Correct? Can you see where your chances of success are going?
Besides, I have no idea what you're talking about when you say "accept statements and variables".
|
|
|
|
|
Dave Kreskowiak wrote: Can you see where your chances of success are going
In the toilet
|
|
|
|
|
That what I think the "urgent" part of his subject line refers to.
|
|
|
|
|
Dave Kreskowiak wrote: That what I think the "urgent" part of his subject line refers to.
|
|
|
|
|
IrfanHaleem wrote: And also tell me what is accept statement and veriables
I don't know what "accept statements" are.
Variables are placeholders for values.
int x = 42;
I've placed the value 42 into the variable x.
IrfanHaleem wrote: How to Produce a menu-driven application that uses accept statements and variables.
You can create a Forms based application using Visual Studio. In the designer you can drag and drop a menu strip onto the Form. This will give you a bare bones menu-driven application.
Hope this helps. Given your vague post, it's the best I can do.
|
|
|
|
|
i want to launch an acrobat.exe through my own application with the edit functionality plugin(edit the pdf documents).Can any body guide how to interact with the Plugin from my application via interface(getdispatch). Although the functionality can be implemented through DDE....but is their any other way possible then pls guide me.
ashutosh
|
|
|
|
|
Here in our product is in C#.I have to port it in Linux . Can you tell me how to port it to Linux/Unix
|
|
|
|
|
As with the post below, you need Mono[^]
|
|
|
|
|
Okay.. But MoNo is not working at industrial Level.This is not much string!!!!
|
|
|
|
|
If Mono isn't as mature as you need it to be then you might want to consider converting your code to a language that doesn't run on the .Net platform. C++ is probably the most universal Linux language, and is also probably one of the easier languages to port C# code to.
|
|
|
|
|
Okay!!! will see..Thank you Very much>>>>
|
|
|
|
|
Hello,
I'm trying to get the regfree functionality working in VS2005, C# but am only
able to get it working with executables. However I need to implement this
within a webservice but this does not seem to work.
Within the webservice project I add a reference to a com dll
(simple test dll written in vb6) and set the isolated property to true.
When I then build the solution the Native.Webservice1.manifest file is generated
correctly.
But as soon as I deploy the webservice to IIS and try to run it I get an error
telling me the comm classid cannot be found. When the dll is registered this error
disappears. Apparently the manifest file is not used.
Somewhere I'm missing something, do I have to do something extra within my solution to
get this working or does it only work for executables and is the only solution back to
dll hell? in case of web projects?
Thanks in advance,
Markuseon
|
|
|
|
|
In the case of COM dlls they have to be registered. That is the difference between the exe and the dll. So what you have experienced is correct. .net is not going to auto register the dll for you and it expects it to be registered to use it.
Ben
|
|
|
|
|
Hello Ben,
Thanks for the reply, I think you are missing the point here.
VS2005 has a feature that automatically creates manifest
files for com dll's. This happens if you set the the isolated
property in the reference to true.
(see : http://msdn.microsoft.com/msdnmag/issues/05/04/RegFreeCOM/[^]
If you use this in a solution that generates an executable this works like a charm,
you do not need to register the dlls anymore. However if you do this in a web project
or webservice this does not work anymore. The manifest files are created correctly but
I have the feeling it does not work because a webservice generates a dotnet dll and no exe.
This however seems strange to me, either I'm overseeing something or Microsoft has
simply not foreseen this and we still remain stuck with dll-hell. Strange in a world
that gets more and more filled with web projects and webservices.
Kind regards,
Markuseon
|
|
|
|