Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
1

1nsp1r3d

@1nsp1r3d
About
Posts
22
Topics
13
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ComboBox question
    1 1nsp1r3d

    Thank you :)

    C# question

  • ComboBox question
    1 1nsp1r3d

    Hi all, I wanted to ask if it is possible to make the combobox only accept values from its dropdown options, because you can just enter some rubbish in the combobox and then I would have to check if the chosen input actually is a valid input(ie one from the options). Is there another way to do this or I would have to validate the input against the options? Regards, gamehack

    C# question

  • Threading
    1 1nsp1r3d

    Hi all, I always wondered, when using the lock statement, people lock other variables that the one which we want to serialize access to. Eg, if we want to serialize the call to a static int(varname++;), why do we chose to lock on another variable? Do we assume that whenever we will want to access this variable again, we're going to check if this variable has been locked previously? Thanks

    C# question

  • Method parameters
    1 1nsp1r3d

    Hi all, As I was reading C# Language Pocket Reference, it says that all parameters are passed by value(ASAIK the book targets .NET 1.0). I thought that all reference types were passed by reference and all value types by value(enums and ints/floats/etc)? Is that the case? Thanks, gamehack

    C# csharp question learning

  • C# Book for a Course
    1 1nsp1r3d

    Hi all, I'll be teaching C# in a school and my audience is quite young(~14-17) so I wanted to ask you what do you think would be the best book I could follow to make them really get into C#? Any suggestions are appreciated. Regards

    C# learning csharp question discussion

  • WPF(Avalon)
    1 1nsp1r3d

    Hi all, I just stumbled upon WPF(Windows Presentation Foundation) and couldn't actually understand the whole thing about it. I wanted to ask if this is the preferred way of writing GUIs for Vista onwards(kind of replacement of SWF?)? Thanks

    .NET (Core and Framework) csharp wpf question

  • Exposing global data
    1 1nsp1r3d

    Thanks :)

    C# question

  • Exposing global data
    1 1nsp1r3d

    Hi all, I want to expose some global strings/ints so I wondered should I be using public const int i = 5; or public static int i = 5;? Thanks. Regards, gamehack

    C# question

  • Strange Behaviour of an Object
    1 1nsp1r3d

    I've found my mistake. It's in my xml handling code. Thanks for reading. Regards

    C# help database xml question

  • Strange Behaviour of an Object
    1 1nsp1r3d

    Hi all, I've encountered a strange behaviour of one of my objects. After it updates itself in a method(updates some private fields) the changes happen when the method is being executed but when execution returns to the line where the method was called, the object is the same as before. Let me show you the code which does this.

    public enum DConfMode
    {
    Normal,
    NoInit
    }

    public class DConf
    {
    	private String hostname;
    	private String database;
    	private String username;
    	private String password;
    
    	public DConf(DConfMode Mode)
    	{
    		switch (Mode)
    		{
    			case DConfMode.Normal:
    				this.Init();
    				break;
    			case DConfMode.NoInit:
    				break;
    		}
    	}
    
    	public void Init()
    	{
    		XmlTextReader reader = new XmlTextReader(DGlobals.ConfFile);
    
    		while (reader.Read())
    		{
    			switch (reader.Name)
    			{
    				case "hostname":
    					this.hostname = reader.Value;
    					break;
    				case "database":
    					this.database = reader.Value;
    					break;
    				case "user":
    					this.username = reader.Value;
    					break;
    				case "password":
    					this.password = reader.Value;
    					break;
    			}
    		}
    		reader.Close();
    	}
    
    	public String DbHostname
    	{
    		get
    		{
    			return this.hostname;
    		}
    	}
    
    	public String DbDatabase
    	{
    		get
    		{
    			return this.database;
    		}
    	}
    
    	public String DbUsername
    	{
    		get
    		{
    			return this.username;
    		}
    	}
    
    	public String DbPassword
    	{
    		get
    		{
    			return this.password;
    		}
    	}
    }
    

    DConf conf = new DConf(DConfMode.NoInit);
    conf.Init();
    Console.WriteLine(conf.DbHostname);

    So DConf does the problem. In the second code excerpt, echoing conf.DbHostname doesn't do anything, but when I've debugged it, in conf.Init(); the values are clearly populated. So I'm quite confused why this happens. Here's some sample xml which you could use: username samplepass localhost dbname As a sidenote, is it safe calling Init(); in DConf's constructor? I suppose no, since it changes fields and the object hasn't been guaranteed to have been fully set up, am I correct? Any help is greatly appreciated. Regards, gamehack -- modified at 19:29 Saturday 29th October, 2005

    C# help database xml question

  • Disassembling MSIL
    1 1nsp1r3d

    Yeah :) You cannot show something without showing it, can you? :)

    The Lounge csharp discussion com help question

  • Disassembling MSIL
    1 1nsp1r3d

    Hello all, I was just browsing around and suddenly found Reflector. And I was completely amazed! Its built-in disassembler gives you all the code! So I compiled a test program and run the disassembler on it and it showed the code was 1:1 with the original. So basically when you ship your .NET program, you're shipping it with the source code, aren't you? I don't think this quite good if you want to protect some non-trivial parts of your program(unless your program is free/open source/etc). So the only think which I thought of doing to remedy this situation is using an obfuscator, which actually is not a solution to the problem, instead of taking N hours, it will take 10xN hours to find the parts you want. I just wanted to share my thoughts with you and see what do you think about this. Any comments are welcome. Regards, gamehack

    The Lounge csharp discussion com help question

  • Application.Run question
    1 1nsp1r3d

    Hi all, I've a question about Application.Run, which is supposed to start the main loop for receiving messages for windows.forms applications. What I want to do is hide the form on startup, which I do either with setting the Visibility property to false or calling Hide(); so far no problems with that. But when I start the loop with Application.Run(form); it makes the form visible. The thing is that it makes the form visible after calling the constructor so what's the proper way of starting a form with Application.Run(Form); which will be hidden? Any advice is appreaciated ;) Regards

    C# question

  • Cross-thread events
    1 1nsp1r3d

    Wouldn't the splash be blocked by the main form and not receive events? Because that's what I think will happen and most solutions for a splash use threads. Or I could be wrong...

    C# winforms design help tutorial question

  • Cross-thread events
    1 1nsp1r3d

    Hi all, Let me introduce you to the problem which I'm trying to cope with. I'm having two windows forms in 2 threads - one is a splash screen and the other one is the main window. On starting, the splash is visible and the main is hidden. I've written everything to the point where I've to implement signalling the splash that main is ready and closing the splash. What I've tried yesterday is to implement this with timers, so splash has a 100ms timer which checks a property on the mainwindow class and if it's true, then the splash closes itself. But then, how would I synchronise the closing of the splash with setting the main form visibility to true so they happen syncroniously(one after the other). What I've been thinking about is using events, but I'm not sure how to do this in cross-threads windows forms, ie how to design it. Should I have event for the main which is emitted when it's ready and the splash listens for this event? And then it closes itself and emits another signal that's has closed and the main listens for the closing signal of the splash? If so, how would I attach to listening to the signals across the threads? In my Main() function, I create both threads and I've two properties of the EntryPoint class(which contains the main and nothing else) - the splash form and the main form. And I have two methods which are used for the entry point of the the both, which are basically doing: Application.Run(this.splashform); Any advice is greatly appreciated. Thanks for reading.

    C# winforms design help tutorial question

  • Splash Screen Architecture
    1 1nsp1r3d

    Hello, I did solve my problem with the initial structure. So this is what I'm doing in Main(): 1. Create Splash thread 2. Start Splash thread 3. Create Main Window Thread 4. Start Main Window Thread 5. Hide Main Window The thing which I'm working now is to implement an event which will signalize the splash screen that main is ready and it should close itself and Main form should appear.

    C# csharp architecture tutorial question

  • Windows Forms Question
    1 1nsp1r3d

    But is this function automatically called? Because I cannot see any point where it is called.

    C# question winforms

  • Windows Forms Question
    1 1nsp1r3d

    Hi all, I've started coding a windows form without the designer and suddenly I needed to set one of this property. Then I took a look at the code and saw that the designer added a function InitializeComponent() and did the setting of the property there. Couldn't the property be set in the Form's constructor? And where can I find some docs on InitializeComponent() cause I looked at MSDN and couldn't find any. Any advice is greatly appreciated. Regards

    C# question winforms

  • Class properties
    1 1nsp1r3d

    Thanks go to both of you :)

    C# csharp com tutorial question

  • Class properties
    1 1nsp1r3d

    Hi all, While reading this tutorial, I encountered this: class SplashScreen : System.Windows.Forms.Form { ... static SplashScreen ms_frmSplash = null; ... } And I'm a bit worried because of this statement. How can a class have a property of itself? Or the static keyword makes it not act as a class property? Thanks.

    C# csharp com tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups