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
H

Heath Stewart

@Heath Stewart
About
Posts
7.9k
Topics
62
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Google + [modified]
    H Heath Stewart

    If there is a network for your workplace and coworkers have declared it, they are grouped automatically. You can also always create groups of people and limit which groups you want to see from the left pane. I've also got my profile quite locked down - almost no public access (just enough to find me; if you don't know me by my picture bug off), networks have almost no access (and even then, just my work network), and bunch of other stuff - more locked down than Facebook's recommended most locked down policy. Facebook is a gaping hole by default, but it can be improved if you have the impetus to do so.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog] [Follow on Twitter]

    The Lounge help question lounge

  • XMLTextReader - Find Max Depth
    H Heath Stewart

    Until you read through the file, the XML reader wouldn't know anyway (even if, as another example, you used an XPathNavigator to search only leaf nodes). But a better question is why you need to find depth? Because to do so may be considered inefficient, maybe first you should determine if you really need to.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog] [Follow on Twitter]

    C# question

  • Cost of living
    H Heath Stewart

    Christian Graus wrote:

    weak minded people

    Which is why education is almost always the first to be cut. Who in the government wants educated taxpayers?

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog] [Follow on Twitter]

    The Lounge com tools tutorial

  • Is it just me?
    H Heath Stewart

    Obviously :), given I said "hordes of money" which we all know the worker doesn't make. :mad:

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    The Lounge question career

  • Bacon
    H Heath Stewart

    Steve Mayfield wrote:

    fat free turkey bacon

    Wouldn't that be a greater offense?

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    The Lounge question announcement

  • Is it just me?
    H Heath Stewart

    Garth J Lancaster wrote:

    the whole lot of them should be signing up for welfare

    I certainly hope that wouldn't be the case. Assuming they haven't p*ssed away their hordes of money that's probably not trickling down, they probably don't even need to work, save the drive of greed. I mean, why does Murdoch keep buying up all these other media companies? Because he thinks he can make them better news outlets? Doubtful - he owns Fox "News" afterall.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    The Lounge question career

  • Break code execution from base class in inherited form
    H Heath Stewart

    Thanks! :-D I might have to make that first one part of my sig.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    C# question csharp winforms

  • Delete a File - "File does not exist"
    H Heath Stewart

    Because you have a backslash at the beginning, which means the search starts from the root of the drive. For example, if your web root is locally on the C: drive, then you're code is looking for C:\Files\whatever. I doubt that's what you want. If your files root is under your web application root - not generally a good idea since people then have direct access at least for file extensions not configured with your server software (ex: IIS) - you can use ~ to resolve the path like so:

    // Assumes you're running this from within an ASP.NET Page
    string root = Server.MapPath("~/Files");
    string path = Path.Combine(root, filename);
    if (File.Exists(path))
    {
    File.Delete(path);
    }

    It's also a good idea to use Path.Combine, which works on any manage host environment (though Windows is most typical) and takes care of any trailing backslashes since double backslashes in some use cases can cause problems (referencing back to root, for example).

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    C# question help

  • Create Dial Up Connection
    H Heath Stewart

    You'll need to P/Invoke RAS APIs documented at http://msdn.microsoft.com/en-us/library/aa446739(v=VS.85).aspx[^]. Fortunately, here on CodeProject someone already shows you how: A web based dialup Internet application[^]. It contains the APIs within an ASP.NET application but you wouldn't need to. The classes and methods it uses should work in any host like Windows Forms.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    C# csharp question

  • Torchwood
    H Heath Stewart

    Actually just saw it. It was really good and I can't wait for more!

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    The Lounge wpf csharp com architecture

  • Google+
    H Heath Stewart

    But it's still a fair point: "kids these days" seem overly connected and don't even know their neighbors, and that level of being "on" certainly can't be sustained in a mentally (or possibly physically) healthy way. I'm reminded of "Spider's" (Henry Rollins) rant about "NAS" in "Johnny Mnemonic". Of course, when isn't Henry Rollins ranting about something (which made him perfect for the part). Yeah, I'll an old 32 but have been connected since BBS days. Just saying there is a healthy limit.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    The Lounge tools php com question

  • Break code execution from base class in inherited form
    H Heath Stewart

    That's how subtyping works. When you crete an instance of the child class, all code is executing against that instance. If the base class defines handlers for events like in your case, it still executes against that instance of the child class you created. But what is it that's not working? Both events can be defined on the base class, like so:

    internal abstract class MyFormBase : Form
    {
    DataGridView dataGridView1;

    protected MyFormBase()
    {
    dataGridView1 = new DataGridView();
    dataGridView1.CellClick += OnDataGridViewCellClick;
    // Other initialization
    }

    protected virtual string Message
    {
    get { return "Message from the base class."; }
    }

    protected virtual void OnDataGridViewCellClick(object sender, DataGridViewCellEventArgs e)
    {
    // Override this in your child class if you wish.
    }

    protected virtual void OnDataGridViewColumnHeaderMouseClick(object sender, DataGridViewBindingCompleteEventArgs e)
    {
    MessageBox.Show(Message, "Test");
    }
    }

    internal class MyChildForm : MyFormBase
    {
    protected override string Message
    {
    get { return "Message from the child class."; }
    }

    protected override void OnDataGridViewCellClick(object sender, DataGridViewCellEventArgs e)
    {
    MessageBox.Show("You clicked a cell.", "Test");

    // Example of how to call a base method. Not always required, and in this case doesn't do anyway.
    // However, for some virtual methods it's very important to call the base so read documentation.
    base.OnDataGridViewCellClick(sender, e);
    

    }
    }

    Now when you create an instance of MyChildForm and click a column header, you'll see "Message from the child class" even though the event handler is defined in the base class. It calls the virtual (overridable) property which IS the property on the MyChildForm instance. If you want to call the base class's method, use base. You also overrided the CellClick event handler which will show "You clicked a cell." I also show an example of calling the base class's method though in this case it doesn't do anyway. If it would never do anything, define it as abstract instead of virtual and remove the body like so:

    private abstract void OnDataGridViewCellClick(object sender, DataGridViewCellEventArgs e);

    Hopefully this shows you an example of how polymorphism is working such that you can define your handlers in your base class but have it access the data - expectedly - in the child class.

    C# question csharp winforms

  • unblock some item in form
    H Heath Stewart

    It would seem you're blocking the UI thread - you're making the UI thread do so much work it can't keep up with all the other requests like to repaint. I assume you're executing this code in response to some control event or initialization code? While I'm sure this is just an example, assuming there's other work you should do that work in a worker thread and invoke the property setting on the UI thread since many times executing code on a control in a different thread than in which it was created can cause issues. First you'll need to define a method to set your image property.

    private void SetImageLocation(string uri)
    {
    if (pictureBox1.InvokeRequired)
    {
    Action setImageLocation = SetImageLocation;
    pictureBox1.Invoke(setImageLocation, new object[] { uri });
    }
    else
    {
    pictureBox1.ImageLocation = uri;
    }
    }

    To create a worker thread, consider using the ThreadPool like so:

    private void DoWork()
    {
    for (int i = 0; i < 20000; ++i)
    {
    if (i == 5000)
    {
    SetImageLocation("x.gif");
    }
    }
    }

    // Assumes you're executing work in response to a Button.Click event.
    private void button1_Click(object sender, EventArgs e)
    {
    ThreadPool.QueueUserWorkItem(DoWork);
    }

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    C# help

  • Torchwood
    H Heath Stewart

    Didn't seem like it to me. It was mentioned in various articles about the return of Torchwood. But it does suck I have to wait too. I'm hoping Netflix picks it up sooner than Comcast. I'm certainly eager to learn why they moved it. And since American's are usually portrayed as trigger-happy in all our shows I'm hoping it doesn't turn out to be some supernatural A-Team, considering that Captain Jack is also known as The Face (of Boe). Or at least that is hinted at. :)

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    The Lounge wpf csharp com architecture

  • How far back are reputation points calculated?
    H Heath Stewart

    Sounds great! Give me a heads up when you have a date in mind.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    Site Bugs / Suggestions csharp css visual-studio com sysadmin

  • How far back are reputation points calculated?
    H Heath Stewart

    Thanks for the explanation, Chris. I try to make it back here from time to time. Nice to see so many familiar names still.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    Site Bugs / Suggestions csharp css visual-studio com sysadmin

  • How far back are reputation points calculated?
    H Heath Stewart

    I don't think they did but shouldn't just having posted one count?

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    Site Bugs / Suggestions csharp css visual-studio com sysadmin

  • How far back are reputation points calculated?
    H Heath Stewart

    Which is another reason I know it's wrong. :) One of the reasons I got an MVP in 2004 is partly because of the amount fo community support I did on CodeProject - all the C# forum at that time. If reputation is calculated all the way back, did perhaps the relationship of "programming forums" to the old/new "C#" forum change?

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    Site Bugs / Suggestions csharp css visual-studio com sysadmin

  • How far back are reputation points calculated?
    H Heath Stewart

    I'm not as active on this site as I us to be, but once upon a time I was a C# MVP posting between 600-800 respones mainly in the C# forum per month for several years (well, at that volume probably about 1.5 years or so). That was back before 2005. Are reputation points calculated that far back? Given my "Authority" reputation score it would seem not, but it seems that Author reputation points are more or less correct.

    This posting is provided "AS IS" with no warranties, and confers no rights. Program Manager II Visual Studio Professional Deployment Experience Microsoft [My Articles] [My Blog]

    Site Bugs / Suggestions csharp css visual-studio com sysadmin

  • Help with setting and expanding nodes in treeview
    H Heath Stewart

    As mentioned, "you recurse through the children using the Nodes property". The Nodes property is on TreeView class and on the TreeNode class (which is used to recurse into subnodes).

    This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

    C# help
  • Login

  • Don't have an account? Register

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