|
I wrote an article here: http://www.codeproject.com/csharp/dotnetvisualstyles.asp[^]. If you target .NET 1.1 or higher, you can also call Application.EnableVisualStyles BEFORE you call Application.Run in your entry point (Main ). This only works on .NET 1.1 and higher, though, and achieves the same functionality as what I document in my article (which works for .NET 1.0 and higher).
-----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-----
|
|
|
|
|
Heath,
It was easy to use the Application.EnableVisualSytles() and make sure the controls FlatStyle was "System". Also, It worked in the C++ environment too!
Cool!
Larry J. Siddens
|
|
|
|
|
Note that C++.NET (Managed C++, or MC++) compiles to the same thing as C#, VB.NET, or any other languages targeting the CLR, so long as your MC++ is written using purely managed code (no mixed mode). This is important to understand: all managed languages compile to (roughly) the same thing: IL. They also have access to the base class library, as well as other assemblies no matter source language they were written in - they all contain IL code.
-----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 Larry
I think I´ve got something for you
I can send you as attached zip file
email me
Huseyin
|
|
|
|
|
I am building an ASP.NET Web site with C#. The design is very much like a portal, where I can load/unload different controls withing the default page. In one of the controls, a user clicks a button to add an item to a "shopping cart", in another control. The first call to my "Add to Cart" function does nothing, however, subsequent clicks on the button work fine.
Any advice on this would be greatly appreciated.
Thanks,
Ben
|
|
|
|
|
It sounds like you're not loading controls in the right event handlers. There is a specific order to how things are handled (like the Page.Load event fires before a post-back event like a ServerClick or Button.Click event). If you look at some of the events in the SDK documentation for WebControl derivatives, there is a link that describes the order in which events are fired.
-----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-----
|
|
|
|
|
Thank you for your response, however I can not seem to find what you suggested in the documentation. Could you be more specific on where I can find this in the SDK documentation?
Thanks a million.
Ben
|
|
|
|
|
Control Execution Lifecycle[^]
-----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,
I want to ask a question about Regular expressions.
I want to validate the regular expression pattern if it is written correctly or not? I do not want to test a string against to a regular expression pattern but the regular expression pattern itself.
Is there a way?
Kind Regards
|
|
|
|
|
Just create a new instance of the RegEx . If the regex is invalid, an exception is thrown (this is documented in the class constructor information):
try
{
Regex re = new Regex("/mypattern/");
Console.WriteLine("The regular expression is valid.");
}
catch
{
Console.WriteLine("The regular expression is invalid!");
} If you move the re declaration outside, you can use it if it's valid after the catch (but then the catch should return or something to keep from trying to use the invalid Regex object).
-----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 your help Heath.
|
|
|
|
|
Hi,
I want to write a program that send a notififcation when files or folders in a path has been changed. So I've used FindFirstChangeNotification and WaitForMultipleObjects (same as a sample in MSDN document).
As I read the document when I use INFINITE for time-out of wait function, it will not be timed out. But in my sample after about one minute, wait function will be timed out.
Do you know what's the problem?
Mehdi
|
|
|
|
|
You should be using the FileSystemWatcher component instead. It already wraps all the native functionality up in an easy-to-use component. You can configure the FileSystemWatcher to watch for new, changed, or deleted files and it will fire events when what you want to watch occurs (like changed files or directories) with information about what was changed (one tip: the Changed event is fired three times for each change regardless of file size - after lots of research into event the native methods that the FileSystemWatcher wraps, I still can't figure out why - just make sure your code accomodates that).
As far as your problem goes, are you actually doing this using C#? INFINITE is actually a pre-proc definition for 0xffffffff (you could declare this as a const in C#) and if you're passing this as a string, the function will most likely use the default timeout.
-----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 guys,
I need to give permission to an specific folder to a user using C#. Does anyone ever done that ? Is there any class capable of changing files and folders permissions in .NET ?
thanks in advance
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
English is not my native language so, if you find any spelling erros in my posts, please let me know.
|
|
|
|
|
No, there are no classes in the .NET base class library that can do this, but there are ways you can P/Invoke the necessary functions. Search the comments for this forum, as I know we've talked about it before. I also remember seeing an article or two here on CP about the topic as well.
-----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-----
|
|
|
|
|
When initially laying out the project, or a portion of the project, is it better to start with the interfaces and save the implementation code until later or just write the classes and then write the code that uses them?
Stated another way, Top down or Bottom up?
Thanks,
Ken Galer
Electrical Engineer
Preferred Utilities Corp.
Danbury, CT 06810
|
|
|
|
|
First, create a good design and then go either way. When it comes to UI logic, though (like handling click events and what-not), it's far easier to design the UI first. I personally like creating all my "utility" classes first, though. But jumping into either the front- or back-end without a good design is like diving into a pool without first checking the depth.
Also, when working with data-driven applications, it's better to develop at least the majority of your database elements (tables, views, stored procs, etc.) first. Creating business objects around these is also helpful, but not always necessary.
-----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-----
|
|
|
|
|
i agree with u Heath Stewart
and i want to say that the analysing phase in so important and evry day in analysing save 5 days in implementaion time, and u can not start the first step in implementaion unless u finished the last step in analysing and design and u r already know what u r going to do till the end
|
|
|
|
|
I understand what both of are saying and agree. I think that I mis-stated the question.
Under the covers of the GUI, when designing whatever custom classes you require and their interfaces, do you normaly design the class:interfaces first and then the classes themselves after you are sure that you can use the classes the why you like?
I'm a C programmer trying to explicitly cast myself as a C# programmer so this is coming from a newbi.
Having just finished the chapter and FINALLY understanding the concept of interfaces ( i hope ) it seems to me that interfaces can act as sort of a prototype for the class.
Do you gyz, as experienced programmers in C#, find this to be useful or does it turn out to be not an issue?
Thanks
Ken Galer
Electrical Engineer
Preferred Utilities Corp.
Danbury, CT 06810
|
|
|
|
|
i have got code that use Microsoft spell checker, but when i tryed to compile it i have got erorr in this line:
////////////////
using Word;
//////////////
the erorr is :-
"The type or namespace name 'Word' could not be found (are you missing a using directive or an assembly reference?)"
so i wanna know how to make my application show word class
and thnx in advance
|
|
|
|
|
using Office = Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
i typed the full path but the code doesn't compile at all
this code is:
private void btn_create_Click(object sender, System.EventArgs e)
{
Microsoft.Office.Interop.Word.Application newApp = new Microsoft.Office.Interop.Word.Application();
l_status.Text+="object instantiated\n";
object Source="c:\\abc\\dat.doc";
object Target="c:\\abc\\Target.rtf";
object Unknown =Type.Missing;
// Source document open here
// Additional Parameters are not known so that are
// set as a missing type
newApp.Documents.Open(ref Source,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,ref Unknown);
l_status.Text+="file opened\n";
// Specifying the format in which you want the output file
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF;
l_status.Text+="new format created";
//Changing the format of the document
newApp.ActiveDocument.SaveAs(ref Target,ref format,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown);
l_status.Text+="new file saved \n";
// for closing the application
newApp.Quit(ref Unknown,ref Unknown,ref Unknown);
l_status.Text+="object closed \n";
}
===============================================
the error message is :
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in code_container.exe
Additional information: The server threw an exception.
|
|
|
|
|
hazzem elrefai wrote:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in code_container.exe
Indicates that the code has compiled. You have a runtime error.
What line did this happen on?
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
the error in the main finction line :
and i couldn't get any meaningful data from this erorr
static void Main()
{
Application.Run(new MainForm());
}
|
|
|
|
|
I suspect this is where the exception was CAUGHT. Not where it was generated/thrown.
static void Main()
{
try
{
Application.Run(new MainForm());
}
catch(Exception e)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.StackTrace);
}
}
Will write to the output the location that the error was generated. This will help with solving the problem.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|