Skip to content

C#

C# discussions

This category can be followed from the open social web via the handle c-065f1d12@forum.codeproject.com

93.7k Topics 383.1k Posts
  • Private Assembly Security - how?

    question security
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Role Based Security

    database sysadmin security question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Folder Events

    question
    2
    0 Votes
    2 Posts
    0 Views
    J
    System.IO.FileSystemWatcher There is a cavet though: (from the docs) "FileSystemWatcher only works on Windows 2000 and Windows NT 4.0. Remote computers must have one of these platforms installed for the component to function properly. However, you cannot watch a remote Windows NT 4.0 computer from a Windows NT 4.0 computer." I'm not familiar with the respective Win32 APIs, but if this cavet doesn't exist there you could write some managed C++ to use the APIs directly, allowing you to target Win98/ME. James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002
  • ArrayList

    java graphics question
    2
    0 Votes
    2 Posts
    0 Views
    J
    You access it just like an array :) ArrayList al = new ArrayList(); // fill the array list MyDataType elementZero = (MyDataType) al[0]; MyDataType elementOne = (MyDataType) al[1]; James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002
  • Invoking loaded types

    data-structures help question
    2
    0 Votes
    2 Posts
    0 Views
    J
    is the array thats filled in the first block of code? Perhaps if you posted more code something will pop out. James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002
  • .NET scanners

    csharp json question
    2
    0 Votes
    2 Posts
    0 Views
    P
    AFAIK there is no built in support for scanning. You might be able to interface with TWAIN through .NET interop, but its sure to be messy. I heard that Lead tools was releasing an imaging product for .NET. That might have what you need. -- Peter Stephens
  • LVN_ODCACHEHINT and LVN_ODFINDITEM

    help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • System name using C#

    csharp tutorial question
    11
    0 Votes
    11 Posts
    0 Views
    O
    Sorry if I underestimated c#. Here you go. One more property to get the machine name... System.Environment.Machinename omkamal
  • Installing Windows Service

    csharp dotnet tools question
    2
    0 Votes
    2 Posts
    0 Views
    O
    Oops Sorry folks. I read that you need .net framework to atleast run a .NET application ( no matter its a service or whatever ). So there is no way but to rely on InstallUtil.exe. Thanks anyways omkamal
  • Downcasting in C#?

    question csharp help
    2
    0 Votes
    2 Posts
    0 Views
    P
    AFAIK that can't be done in C#. The 'foo' object never was a 'bar' object and can't be cast in that direction. A new 'bar' reference CAN be cast into a foo reference and then back into a 'bar' reference though. You cannot cast this way in a strongly typed language. You may be able to do this in C++ (with reinterpret_cast) but the virtual tables will be messed up and strange bugs WILL happen. -- Peter Stephens
  • VS.NET and Product Activation

    csharp visual-studio question
    2
    0 Votes
    2 Posts
    0 Views
    K
    I did not install it yet, but it does not look like it will need activation, because a key is provided to MSDN subscribers.
  • Array Size ?

    question data-structures
    2
    0 Votes
    2 Posts
    0 Views
    J
    Hi , Try foo.Length Cheers, Joao Vaz
  • VS.NET style docking windows - free source

    csharp visual-studio announcement
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Dynamic Assemblies

    question
    4
    0 Votes
    4 Posts
    0 Views
    L
    Cool this has really helped me alot, i have found one sample using google search engine. Are there any others that people can point me too cause a few examples would be better :) Thanks for your help anyway :)
  • Combine ListView and TreeView

    question help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Mail Encoding and Decoding Problem

    help question tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • "event bubbling" for winform control

    question
    5
    0 Votes
    5 Posts
    0 Views
    S
    Here's a sample EventsManger class. All it does is check to see if there are any listeners for registered events. As you can see it's very simple. public class EventsManager { public delegate void EventHandler(Object sender); public event EventHandler EventsHolder; protected virtual void OnEventOccurred() { if(EventsHolder != null) //meaning there is a listener for the event somewhere EventsHolder(this); } public void EventWasFired() { OnEventOccurred(); } } I prefer to have my entry point in a class called driver (I'm used to C++) so I declare the following... public class driver { //declare an events manager variable, make it public static so you can query it from all classes in your //namespace public static EventsManager em; static void Main() { em = new EventsManager(); Application.Run(new Form1()); } } To test it, I created a user control with a button on it. i.e. a composite control. Now, I want that when I press the button, the user control back color turns red, ie, the button_click event gets bubbled up to the parent control so to speak. To make things easy, you can make your user control take an EventsManager as a constructor paramater.Then register a listener like so... public UserControl1(EventsManager em) { InitializeComponent(); em.EventsHolder += new EventsManager.EventHandler(ButtonWasPressed); } private void ButtonWasPressed(Object sender) { this.BackColor = Color.Red; } You can then fire the event from the button's OnClick event like so private void button1_Click(object sender, System.EventArgs e) { driver.em.EventWasFired(); } You'll notice that I don't use EventArgs in my delegate declaration. I left that out because it's of no real use here. But it's advisable fro you to do this. (I typically derive a class from EventArgs and stuff it with mty own event specific code) Well it's ugly but it works for me, hope it helps Just another wannabe code junky
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Problem in Calling Unmanaged code

    csharp help tutorial question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied