|
DOH!
Guess I shouldn't code with only 4 hours of sleep.
Thanks Heath
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
I would like to add "panels" to my application which behave like the Visual Studio .NET IDE "ToolBox", "Solution" and "Properties" "Panels". These panels have a tab when retracted, and when your cursor goes over them they expand out, and retract when your cursor moves off of them. Or you can click the pushPin and they remain expanded. Does any one know the control these are built on? Does anyone know of any source code examples?
|
|
|
|
|
There used to be the Magic Library which provided a free control that had that type of behaviour. However, they are now charging $300 for it!
Infragistics controls also provide the capability.
In both cases, they deployed a manager that handled all of the paint events and causing the sliding, tabs, etc. Then for magic you just add a form to the manager and in the Infragistics control you just right click a control and select Add to Tab.
So that gives you a general direction they took.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
Hi,
I am showing a form creating user profile where it asks for passwords. When he searches for a user the password that is shown is MD5 encrypted, now if he clicks update the encrypted password is again encrypted as I don't know how to find if the password displayed is already a MD5 encrypted string or not.
Any suggestions !?!
Thanks,
Paul
|
|
|
|
|
You could either store a value that dictates whether the password is already hashed. For instance, some clients have a "Remember password" (or similar) option. This value would be stored in the registry or a file along with the hashed password. Check this value and, if set, don't hash the password again.
You could also determine if the length of the string is 32 characters in length, although this is not the best test since some users might have passwords that long (doubtful, but possible). You could, though, limit the password length to something less than 32 characters, so that if you get a "password" that is 32 characters long you know it is already hashed.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi there,
Is it possible to separate declarations and implementations in C#?
like for C++ I want to separate the declarations of the classes in a header and implementations in a cs file...
Thanks.
bouli.
|
|
|
|
|
No, its not possible to separate the declaration from the implementation. There is no need for that to happen as you don't need to #include headers anywhere. IMO that is one of the better features of C# over C++.
Out of curiosity why do you want to do this anyway?
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|
|
ok, thanks for the information,
as I have C++ & MFC backgrounds, I want to upgrade my knowledges to C#...
|
|
|
|
|
You should start with the C# Language Specifications at http://msdn.microsoft.com/library/en-us/cscon/html/vcoriCStartPage.asp[^]. Also understand that C# is just another language that targets the Common Language Runtime (CLR), the runtime part of the .NET Framework. All .NET compilers compile to similar IL. The only differences in the generated IL usually have to do with compiler optimizations, but some languages support features of the .NET Framework that others don't. For example, C# supports unsafe contexts (in order to use pointers for, say, quick string parsing) while VB.NET does not (yet). But this is not really a feature of C# per se, but a feature of the .NET Framework that C# supports.
Also understand that assemblies written in any source languages can be used by any other managed language.
Finally, there is also Managed C++ that can compile down to IL in an assembly. The major thing to realize here is that you can use mixed mode or pure managed code. Mixed mode includes native implementations that aren't managed by the CLR while pure managed code is.
It's call "managed" because the CLR managed the memory (though classes that encapsulate native resources like Windows should implement IDisposable and clean-up the native resources since they aren't managed by the CLR).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
Thanks for your reply.
I know that there is MC++ that can access to CLR, but I wanna learn C#. C# seems to be more convinent to access .NET features. I have to write an application that targets Excel 2003 in C#. I don't want to program Excel 2003 with C++, it would be too complex, while Excel 2003 is designed to be easily accessed via C# or VB .NET...
While learning C# which I discover since last monday, I need to get the equivalents between C++ and C# to go faster in my learning, for this, I translate some simple MFC applications in C#...
C# in itself is easy (it's very similar to C++), but it's the .NET framework that is not easy for a beginner in .NET. I have the same feelings with .NET that I had with MFC 10 years ago: " wow!"
best regards.
bouli.
|
|
|
|
|
I only mentioned that about MC++ to help you better understand the .NET Framework. I read that you wanted to learn C#.
You should also scan through the .NET Base Class Library reference in your help files (or on MSDN Online). Knowing what's there is good so that you can think of better solutions using what's provided. Also look through them any articles here on CodeProject for examples of programming with C#. There's also several examples in the .NET Framework SDK.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
This site, some books and MSDN library are my starting point...
|
|
|
|
|
Colin Angus Mackay wrote:
No, its not possible to separate the declaration from the implementation. There is no need for that to happen as you don't need to #include headers anywhere. IMO that is one of the better features of C# over C++.
This is not inherently correct. While it maybe in the context of C++ (i.e.; no header files in C#), you can have a separate file that is part of the same namespace which simply defines interfaces. These interfaces can then be implemented throughout your application as a whole. This could be seen as a separation of declaration and implementation.
- Nick Parker My Blog
|
|
|
|
|
Nick Parker wrote:
This is not inherently correct. While it maybe in the context of C++ (i.e.; no header files in C#), you can have a separate file that is part of the same namespace which simply defines interfaces. These interfaces can then be implemented throughout your application as a whole. This could be seen as a separation of declaration and implementation.
That's Wright.
Thank You
Bo Hunter
|
|
|
|
|
Has anybody attempted the following? If not, once I've done it, I'll submit the article!
I want to set up a class that holds a collection of arrays and lets you set up calculations on the arrays that are then run as a block. The calling code would then look something like:
ArrayContainer ac = new ArrayContainer(0, 250);
ContainedArray array1 = ac.NewArray();
ContainedArray array2 = ac.NewArray();
ContainedArray array3 = ac.NewArray();
ac.DefineCalculations();
array1.CurrentRow = array2.CurrentRow + array3.LastRow;
array2.CurrentRow = array2.LastRow - 3;
array3.CurrentRow = array1.LastRow * 2;
ac.DoCalculations();
The last line makes it go through all 251 rows of the three arrays iteratively carrying out the calculations.
Many thanks
Bernard
|
|
|
|
|
There's one major problem:
array1.CurrentRow = array2.CurrentRow + array3.LastRow;
array2.CurrentRow = array2.LastRow - 3;
array3.CurrentRow = array1.LastRow * 2; This will be executed as-is by the CLR because the expressions are compiled to IL as you see them. Instead, you should consider storing an expression string as you could with a ColumnHeader (for a DataGrid ). You would have to devise somewhere to parse this expression, thoug, perhaps using a string tokenizer like we've done in our app I architected at work. There is an article that includes source that was the basis for our string tokenizer: http://www.c-sharpcorner.com/Code/2003/June/JavaLikeStringTokenizer.asp[^]. This may help.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for this - I'll have a look at the article. I broadly had in mind that by overloading the operators, I could have them 'stack up' the commands in a buffer (I had Forth and Reverse Polish Notation in mind). The execute method would then run through the buffer, Emit it (perhaps), and then execute it repeatedly.
|
|
|
|
|
I think this wouldn't be too hard.
class ArrayContainer : CollectionBase (.. blah blah..)
And then just define operators on the ContainedArray class, but with one catch! Just store the actions (iow create a stack), and only invoke it on the DOCalc().
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Hi guys,
I have 2 newbies questions in C#:
- what is the equivalent of WM_NCHITTEST message in C#? I want to detect the movments of a window (Form) when the user moves it with the mouse. I tried the MouseUp and MouseDown events, but it works only in the client area of the form (like for C++)
- how to include a manifest resource in C# to apply the current theme in each forms of the application?
Thanks
Best regards.
bouli.
|
|
|
|
|
First question:
<br />
private int WM_NCHITTEST = 132;<br />
<br />
protected override void WndProc(ref Message m)<br />
{<br />
if(m.Msg == WM_NCHITTEST)<br />
Debug.WriteLine("WM_NCHITTEST");<br />
else<br />
base.WndProc(ref m);<br />
}<br />
Second question: No clue!
|
|
|
|
|
Second question: see my article at http://www.codeproject.com/csharp/dotnetvisualstyles.asp[^]. This works for application targeting the .NET 1.0 Framework on up, though .NET 1.1 added an Application.EnableVisualStyles method that you can call before executing Application.Run in your application's entry point. Note that many people have experienced odd problems with the latter method, though, while the method described in my article works because it's exactly what win32 applications do (also note that the .manifest file can stand alone from app as I mentioned, but then you have to worry about deploying that, too).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
Ok, thanks for your link. The EnableVisualStyles is simple
It's even more simple than in C++
|
|
|
|
|
How do you do that? Let's say you have the following code:
<br />
InternetExplorer ie = new InternetExplorer();<br />
IHTMLDocument2 doc = (IHTMLDocument2) ie.Document;
//NOTE: How do I know when or not the method returns a "new" object vs. using the new keyword? eg. WebRequest wr = WebRequest.Create("...") not = new WebRequest (but I only know that because it's in the documentation) ??
Back to InternetExplorer: the problem arises when I try to access any of it's interfaces. Example:
<br />
Object oNull = 0;<br />
Object oNullString = "";<br />
InternetExplorer ie = new InternetExplorer();<br />
ie.Navigate("http://www.google.com/", ref oNull, ref oNullString, ref oNullString, ref oNullString);<br />
System.Threading.Thread.Sleep(5000);<br />
IHTMLElementCollection ec = null;<br />
ec = (ie.Document as IHTMLDocument2).all;<br />
<br />
All the above works perfectly. Now:
ec.item(I don't even know how to use the params properly) or ec.tags("BODY") for example all give me one error: Referenced object does not exist in memory, or something of that sort that means you can't access it.
Help! Good book? Good article?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
First, an empty string ("") is not the same as null . For the null parameters, you should actually do something like this:
object missing = System.Reflection.Missing.Value;
object url = "http://www.google.com";
ie.Navigate2(ref url, ref missing, ref missing, ref missing, ref missing); As you can see above, too, I use Navigate2 . This is recommended by the IE Programming documentation.
As far as casting vs. new , you want to use casting. When you cast to an interface that is delcared as a RCW interface, this results in a QueryInterface of the object as you would do in C++ regarding COM. If null is returned, the object does not implement the interface.
There are several good articles about using the WebBrowser control. See the following search results for a few (especially the top ones): http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=WebBrowser[^].
Also, use the WebBrowser control by interop'ing shdocvw.dll to embed "Internet Explorer" in your application. Use the InternetExplorer object if you want to control a remote application instance through out-of-process automation.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Dear, Sir
How to display copyright sign (c in small circle,©) in Label control?
Thank You.
|
|
|
|