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
K

Kasdoffe

@Kasdoffe
About
Posts
20
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Get an object value using a string
    K Kasdoffe

    This appeared to work for me, and I think it's what you want, using reflection. Note the Main method and GetValueFromString method. (Sorry for the formatting) using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace ConsoleApplication1 { class Program { static void Main(string [] args) { NoddyProcess p = new NoddyProcess(); object o = p.GetValueFromString("foo"); Console.WriteLine(o.ToString()); o = p.GetValueFromString("bar"); Console.WriteLine(o.ToString()); Console.Read(); } } class NoddyClass { public string foo; public string bar; } class NoddyProcess { private NoddyClass nc; public NoddyProcess() { this.nc = new NoddyClass(); this.nc.foo = "thingys"; this.nc.bar = "doodars"; } public object GetValueFromString(string value) { FieldInfo info = nc.GetType().GetField(value,BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public ); return info.GetValue(nc); } } class AnotherNoddyProcess { private void DoSomething() { NoddyProcess np = new NoddyProcess(); np.GetValueFromString("foo"); } } }

    C#

  • .NET Remoting problem
    K Kasdoffe

    I'm trying to create a simple .NET remoting application that can be accessed over Http through the internet, not internally. When I get my object through Activator.GetObject and try to perform a method on that object, I get a System.Web.Exception stating basically (401) unauthorized. Has anyone experienced this and have any tips for me? I'm new to remoting. I tried TCP and couldn't get my router to forward the port correctly. Thanks.

    C# csharp help question

  • DataGridViewColumn DefaultCellStyle help
    K Kasdoffe

    I don't understand the Format property on the defaultCellStyle of the column I just added to a dataGridView. I have it set to Currency with 2 decimals, thus "C2". I fire up my project, double click in the cell, put in 5 and it doesn't format it to '$5.00'. Why not? Am I totally missing something?

    C# help question

  • Display Window's Explorer menu in MY program's context menu
    K Kasdoffe

    I want to add a submenu to my programs context menu that will then show the standard Window's Explorer submenu. Any ideas? If anyone has ever used the program Tortoise CVS, it does such a thing. When you choose to Commit a set of files, right clicking on a file in the list displays the CVS menus, but there's also a submenu called Explorer. Highlighting this menu then displays a submenu just like you were in Window's Explorer and right clicked the file there. help please..

    C# help question

  • Get Previous Window Handle?
    K Kasdoffe

    I couldn't seem to get that to work. However, I did find another solution. I found a class that receives all mouse and keyboard events from the system. I hooked up a couple events and now my program is told when someone clicks the mouse or presses a key. Then I just GetForeGroundWindow to get the active window and change the IntPtr my program is using to know what has focus. Works great!

    C# question json

  • Get Previous Window Handle?
    K Kasdoffe

    That doesn't help though. Within my code, I don't know which program just started or which program just had focus. It could be notepad, it could be IE, it could Vis Studio, or FireFox. It doesn't matter what the program is, I want the window handle of the window that had focus prior to my program.

    C# question json

  • Get Previous Window Handle?
    K Kasdoffe

    If my program is running and I start a program such as Internet Explorer, how do I get the window handle of IE when my programs is activated and gets focus again? I want to send keystrokes to differing programs. Currently, the only window I can get is the foreground window using the GetForeGroundWindow API when my program initially starts. If a new program starts while mine is running, in order to send keystrokes to it, I need to close my program and restart it, so I can get the new foreground window. Make sense? Any ideas?

    C# question json

  • ListView Help
    K Kasdoffe

    that is my hope.

    C# question com help

  • ListView Help
    K Kasdoffe

    I want to display 50% opaque progressbars on top of my listview items as seen in this screenshot. My Test ScreenShot The screenshot is a hack I made to show what I want to happen. How can I do this? I need the listview items to be seen through the progressbar controls and respond to mouse-events, etc. Is there some way to extend the listview items to get this functionality?

    C# question com help

  • Help me with my ListView Idea!
    K Kasdoffe

    I've created a program to track my tasks I have to do at work. I use a listview to display the tasks. Some of my tasks require certain steps be followed before I can complete them. I plan on adding the ability to add requirements to a task. But, here's my idea! I would like to somehow be able to have a ProgressBar that is somewhat transparent across the entire row of each task that shows the progress of that task. I'm trying to figure out if it's possible to have a 1/2 transparent progressbar display on top of each of my tasks. Is it possible? How can I do this?

    C# question business help

  • XMLSerializer and a collection of collections?
    K Kasdoffe

    Doh! I had my collection inside my Task class setup as an XMLAttribute. I removed the syntax and it worked.

    C# question

  • XMLSerializer and a collection of collections?
    K Kasdoffe

    Can I use the XMLSerializer to serializer a collection of collections? I have a TaskCollection class that is a collection of Tasks. My task class has an instance of a RecordCollection class that is a collection of Records. So it goes TaskCollection -> Task -> RecordCollection -> Record. I was able to XMLSerialize the TaskCollection before I added a RecordCollection to my Task class. Why can't I serialize a collection of a class that has a collection of another class?

    C# question

  • .NET remoting and Simple Client / Server application design help...
    K Kasdoffe

    This morning I created a simple remotable object with a delegate and event using that delgate. On the server side where I created the object, I setup an eventhandler for the event I created and marshaled the object. On the client side when I get a reference to the object using Activator.GetObject and I try creating an eventHandler for the same event, I get a security policy error. I was hoping that setting up an eventhandler on the object on both server and client sides that it would be a way that I could communicate back and forth between the server and client. I know that this is probably a misguided attempt at client/server and server/client communication, but I'm new to this. Can anyone point me in the right direction?

    C# csharp design sysadmin xml help

  • .NET remoting and Simple Client / Server application design help...
    K Kasdoffe

    I've been dabbling with .NET remoting in the past few days and I'm completely new to it. I've successfully created a client application that accesses a marshaled object by a server application and updates it, therefore reflecting the change on the server side. So, I've been thinking about going bigger with my dabblings.. I'd like to create a simple application where a user can create an order of something, say hamburgers. When the user selects the # of hamburgers and enters their name, they can press a button to send the order. I want the server side to receive the order and store it in xml. So, I've been thinking about this and applying what I know of C# and .NET remoting. What's the best way to get an order to the server without using large objects? Should I create a simple remotable object with an Add and Delete method that accepts an order? Then, should I create delegates in that class for Add and Delete so that my server application can listen for the Add and Delete delgates? Should I have a constructor for my remotable object that accepts a reference to my server's forms, methods, etc and forget about delegates? Please remember that I'm fairly new to this... help is appreciated..

    C# csharp design sysadmin xml help

  • How to do a balloon tip in a tray icon in C#
    K Kasdoffe

    did you see this: http://www.thecodeproject.com/cs/miscctrl/notifyiconex.asp[^]

    C# csharp tutorial question

  • Show 1st instance of application when starting 2nd instance?
    K Kasdoffe

    When my program starts, I want to check if it's already running. If it is running, I want to show it and bring it to the foreground. I know multiple ways of checking if my program is already running by using the Process class or Mutex class. However, my main problem comes when trying to get my program to show itself. I'm using a NotifyIcon and ShowInTaskBar is set to false. When my program is minimized to the system tray and the second process starts and uses the Process class to get the MainWindowHandle of the 1st process, it returns 0. I experimented with it and found that if I kept my program in the taskbar by setting ShowInTaskbar to true, it would have a non-zero MainWindowHandle I can use. But, I don't want it in the taskbar. So, how can reactivate my already running program if I try to start a 2nd instance of it when the MainWindowHandle is 0? I probably could save the window handle to a file (suck!) and use it when a second instance starts. Help please?

    C# help question

  • How to change error icon shown in datagrid cells
    K Kasdoffe

    I want to be able to change the error icon shown in the datagrid cells on a per cell basis when i use the SetColumnError method. For example, my application has errors and warnings. Errors prevent a user from saving any changes and warnings are only a visual indicator that the user needs to read. I want to display the normal red error icon for errors, but want to display a different icon (a yellow error icon) on a warning. How can I change this icon?

    C# tutorial question help

  • Reflection Assistance please!
    K Kasdoffe

    Kasdoffe wrote: I think I understand what you're doing here, except for the last 2 lines Nevermind, I'm dumb :) Anyways I got it to work like you showed except I had to add BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public as the second parameter to the GetField() method. Thanks for your help! This is awesome!

    C# question csharp help tutorial

  • Reflection Assistance please!
    K Kasdoffe

    I think I understand what you're doing here, except for the last 2 lines. I don't have the object reference for my textbox. All i have is the name of the textbox. I need to be able to get this reference and set the text property on my textbox control.

    C# question csharp help tutorial

  • Reflection Assistance please!
    K Kasdoffe

    Very simple example of what I want to do. I have a textbox on my form: TextBox textBox1 = new TextBox(); I have a string containing the name of my textbox: string strControlName = "textBox1"; I have a string that contains the text for my textbox to display: string strControlText = "Hello World"; How do i use strControlName and strControlText to set my textbox's text property? (without looping through my controls on the form and using if statements). In another language I know, you can use 'Indirection'. It's a very useful and powerful tool. This acts similar to the following: set (@strControlName).Text = strControlText where the end result is textBox1.Text = "Hello World". I would love to be able to do this in C#! I was told to read up on reflection, but couldn't find what I wanted. Is there somehow a way to modify an existing control when all you know is the control name? (without looping through all the controls) Please help!

    C# question csharp help tutorial
  • Login

  • Don't have an account? Register

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