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
X

XRaheemX

@XRaheemX
About
Posts
83
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Trace Question
    X XRaheemX

    If you're wanting specifically to work with the eventlog, try using the System.Diagnostics.EventLog class. This will provide all of the writing methods you will need -- including writing an "error" event.

    C# question debugging help

  • Load Balanced Network
    X XRaheemX

    As far as I know, load balancing is not done at the software application level. If NICs are load balanced they should automatically balance the traffice between the merged NICs. When you send traffic using .NET the load balancing should be auto handled.

    C# sysadmin csharp question

  • Catching application start/close events
    X XRaheemX

    Well, one way you could do this (which isn't the best way I don't imagine, but I can't think of any other way at the moment) is to create a task watcher process that watches the task list and kicks off event "alerts" that you set when certain tasks are created/exited.

    C# tutorial database

  • Windows Search Gif
    X XRaheemX

    What!?

    C# question

  • Disabling controls
    X XRaheemX

    Unfortunately for right now, if you're wanting to do real time text checks on the web page then some type of Client side script (such as Javascript) is your only option. The only way for the server to manage this is for the page to postback to the server every time the user presses a key in the textbox, which would keep them from typing more than say.. 3 words per minute.

    C# question csharp javascript sysadmin

  • Disaplying different panels from options in a dropdown list
    X XRaheemX

    omg I'm so sorry... my mind was in VB.NET when I wrote this. (VB uses the keywork SELECT instead of SWITCH that is used in C#"

    private void Speciality_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        switch(Speciality.SelectedItem.Value.ToLower())
        {
            case "breast surgery":
               SpecialityBreastSurgery.Visible = true;
               break;
    
            case "cardiology":
    	   SpecialityCardiology.Visible = true;
               break;
    
    	default: //In case you want to do something "else"
            break;
        }
    }
    

    Also remember that your strings for your CASE statements MUST be all lowercase in this instance because I used a .ToLower() in the switch. (I have a habit of doing this to remove casing errors). If you want to use exact case, just simply remove the .ToLower() from the switch.

    C# csharp asp-net tutorial

  • Can u help? I need to save data from label to file on hard drive
    X XRaheemX

    Well, for the simple one line of text in a file you won't need to parse anything. You can simply do just the opposite of what I have above. Check if the file exists but don't delete it. Instead of using File.CreateText you will use File.OpenText. Instead of using System.IO.TextWriter use a System.IO.TextReader. Instead of using WriteLine() use ReadLine(). It's all pretty simple. However, if you're putting multiple lines in the file for multiple objects/properties it does get a little more complex. A more simple way to do this would be to just serialize the label (or whatever other oject you have) into a file and deserialize it back from the file to an object in the code whenever you need it. A good example exists right here on code project: http://www.codeproject.com/csharp/objserial.asp[^]

    C# csharp help tutorial question

  • XML Serialization
    X XRaheemX

    Well silly, paste the new exception. It's probably a different exception than before. We'll work them out one by one.

    C# question xml json help

  • DateTimePicker and Regional Setting
    X XRaheemX

    Unfortunately I don't know of a fix, perhaps though you can band-aid it on the other side? When you retrieve the data back out, add 543 to it.

    C# help database csharp sql-server visual-studio

  • Can u help? I need to save data from label to file on hard drive
    X XRaheemX

    I think it does currently but you can never tell what they might change in future releases. So I thought it'd be safe to go ahead and call it anyway.

    C# csharp help tutorial question

  • Xbox 360 Development with the .NET Framework Petition
    X XRaheemX

    I'm completely with you 100%. I've been waiting to hear if they were going to do something in .NET so I could pursue a career in game dev. Where do I sign up?

    C# csharp dotnet com game-dev business

  • Opening External Applications
    X XRaheemX

    System.Diagnostics.Process here is an example of running PING with some arguments:

    using System.Diagnostics;
    
    public void RunPing()
    {
       Process p = new Process();
       p.StartInfo.Arguments = "www.codeproject.com";
       p.StartInfo.FileName = "ping.exe";
       p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
       p.Start();
       p.WaitForExit(5000); // Use this to pause the code until the application closes (this one times out and continues anyway after 5 seconds)
    }
    
    C# tutorial question

  • Confusion on how Firewall works
    X XRaheemX

    No offense to you, but you can probably get a better answer in a different forum than the c# forum. I'll do the best I can though: Firewalls allow the ability to restrict/allow on a URL name basis. Whoever set up your network probably has codeproject.* allowed.

    C# com sysadmin

  • Can u help? I need to save data from label to file on hard drive
    X XRaheemX

    ok.. a VERY simple example would be as such: (This is not at all the complete or best way to do it, just a simple example to start your building blocks)

    public void WriteFile(string text, string fileName)
    {
        System.IO.TextWriter tw = null;
        try
        {
           if(System.IO.File.Exists(fileName))
           {
    	  System.IO.File.Delete(fileName); //Do this if you want to "overwrite" the file
           }
           tw = System.IO.File.CreateText(fileName);
           tw.WriteLine(text);
        }
        finally
        {
           if(tw != null)
           {
               tw.Flush();
    	   tw.Close();  // Put these in the finally clause to make sure that the file closes
           }
        }
    }
    
    C# csharp help tutorial question

  • Disaplying different panels from options in a dropdown list
    X XRaheemX

    Although syntactically my code is correct, are you sure you are using a c# code behind and not a VB.NET code behind? Also, did you paste exactly what I wrote?

    C# csharp asp-net tutorial

  • Can u help? I need to save data from label to file on hard drive
    X XRaheemX

    Haha, I like to take time during my breaks an help people out ;) I'll catch up to them some day... when I'm older and wiser ;)

    C# csharp help tutorial question

  • Can u help? I need to save data from label to file on hard drive
    X XRaheemX

    There are many many different ways to do this. I would research the System.IO.File and System.IO.TextReader and System.IO.TextWriter classes for more help. I could give you an example, but I don't think it would do any good unless we knew what exactly you're trying to do. It could be good as well to research Serialization as this is a nice easy way to Serialize and object to a file.

    C# csharp help tutorial question

  • Properties in structures
    X XRaheemX

    Yessir :laugh:

    C# question

  • Properties in structures
    X XRaheemX

    Ahhh.. I read right over that... Well, you can assign the property as long as you assign the field also. When building a struct constructor, the constructor must not exit until all fields have been assigned. Of course, you're thinking to yourself, "It does get assigned when the property is assigned"... unfortunately the compiler doesn't see that :(

    C# question

  • Properties in structures
    X XRaheemX

    Try this:

    	        struct MyStruct
    		{
    			int fieldx;
    			public int Propertyx
    			{
    				get
    				{
    					return fieldx;
    				}
    				set
    				{
    					fieldx = value;
    				}
    			}
    
    			public MyStruct(int i)
    			{
    				fieldx = i;
    			}
    		}
    
    C# 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