That would be a problem, then. I guess the only thing you could do in such a case is to prevent the admin application from worrying about what's in that table and instead get the remoting object and this admin app to interact instead of using a table as a sort of intermediary.
You can't modify attributes at runtime. You can, however, use an ICustomTypeDescriptor to return an array of attributes that you can create at runtime (note, this interface is only used by certain classes like the TypeDescriptor in System.ComponentModel).
See the documentation for ICustomTypeDescriptor.GetAttributes for more information.
If you use reflection instead of a TypeDescriptor to get attributes, you won't be able to change anything unless you programmatically create an attribute and add it to your array/list/collection.
Finally, if this is a custom attribute, you can give the attribute's property a set accessor as well, but this is to change only a property. This is highly NOT recommend, though, because attributes are meta-data that describe classes, etc. The attributes in the base class library don't allow such changes. If you need to modify values like this, you should consider a abstract or virtual property for a particular type that child classes can override, or using an interface for a good polymorphic design.
Yes, besides being a great music it's the situation I'm in right now.
I've searched and searched and I cannot find what I want, I'm starting to think that it's not possible.
I've developed a service using C#, and used one of the great advantages of .NET, the possibility to easily install a service, I've done everything I wanted, except for this:
Is it possible to set the name of the service during installation?
I must/want to give this option so that the user can install several instances of that service each with a different name. (Gateway I,Gateway II, etc).
See ServiceInstaller and ServiceProcessInstaller. The documentation for these two classes in the .NET Framework SDK also include samples.
Basically, you derive from Installer to create your own installer then add an instance of each of the aforementioned classes according to the documentation.
You can use the installutil.exe utility that is installed with the .NET Framework or include the assembly that includes the installer class in a Windows Installer setup project in VS.NET as a Custom Action.
If you want to set anything during installation, you'll have to use a command-line switch. You can find more information about this in the documentation for the Installer.Context property. You use some code like the following in your derived Installer class to get parameters passed to it from installutil.exe or from Windows Installer:
The first thing is to understand that the ListView class in .NET encapsulates the List-View common control in Windows, as do most controls in the System.Windows.Forms namespace, so doing things like this will typically required that you extend ListView, override WndProc, and handle notification messages. Some Windows programming background will be helpful. You'll also want to know how to P/Invoke native methods. You can find more information in the documentation for the DllImportAttribute in the .NET Framework SDK.
You'll have to handle the drawing of each subitem by handling the NM_CUSTOMDRAW notification message. That will give you a struct (which you'll have to create, namely the NMLVCUSTOMDRAW struct). From information in that you can adjust the starting location of your text (though you'll have to draw it yourself, though that's not hard) and then paint the icon you want next to it. You'll have to figure out how to store that image information, though, be it an index into an ImageList or an Image itself. You could extend ListViewSubItem although you'll have to worry about casting each time.
Note that this may sound like a lot of work (and I'll admit it's not trivial) but it sure beats making your own list view control from scratch! There's a heck of a lot more to worry about than this. In the grand scheme of things, this approach is easy.
If you reply to this, I can send you some old source that shows some examples of owner-drawing. Though not specific to your requirements, it should give you some insight.
I have this little problem which is of pure cosmetic nature, so it doesn't really affect the application, but it would be something I'd really like to have. I searched around and couldn't find a solution for this anywhere, so I hope somebody in here knows the trick. The problem does also apply to any other .NET application, but since my application is written in C#, I post it here first:
My appplication has a nice application icon and opens several windows, which also all have this application icon. Everything looks fine in the windows taskbar, until the moment when the taskbar grouping function of WinXP kicks in. Then the group icon for my application suddenly is the default empty application icon, and the group button itself doesn't have any text, but just states the number of windows grouped, for example "3".
When I click on the group button, every item in the list has the nice application icon, but it seems that the group icon comes from somewhere else, as well as the group button text. Since other applications still have their icon even when the windows are grouped, this property must be able to set somewhere.
I read in a newsgroup that the group icon comes from SystemIcons.Application, which in fact is the empty default windows icon that I see, but this property is read-only, so there is no way for me to confirm that this icon is really used, nor can I change it to my application icon.
In case it is still not clear what I mean to the following to reproduce the problem: Open a new .NET project (C# or VB doesn't matter) and add a second dialog, then add a function in your main dialog that opens up the second dialog when clicking a button or something like that. Edit the App.ico resource so that the icon looks different and make both your windows use this file as the application icon. Now execute the application and press that button that executes your function to open more windows until the taskbar is full and WinXP groups the icons. Then you should be able to see the effect.
In case it is still not clear, I can also post a screenshot, but for the moment I'll just hope that someone is able to understand what I mean.
Set the static property Application.SafeTopLevelCaptionFormat for the group text. As far as the icon goes, I'm frankly surprised this isn't working correctly since Windows should be using the top-level form's icon. The only thing I can think of is to make sure you're using the Application.Run static method to launch your main form.
Easy - an array is a valid source for a repeater ( and that's all you need here, so why use anything heavier ? ), so store the index you're up to in viewstate, then grab the array you need from the array of arrays and make it the data source for a repeater.
Ooops - forget that if you're not doing a web page. Instead, just pass the arrays to a datagrid.
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
privateint currentIndex = -1; // before the start of the array
In your button click event handler:
if (currentIndex==5) // Don't run off the end of the array
currentIndex = 0; // Reset to the start// Build the label text
StringBuilder sb = new StringBuilder();
for(int i=0; i<9; i++)
labDisp.Text = sb.ToString();
I'm assuming your array is called "arrayObject" since you didn't mention it anywhere.
switch( keyData )
bIsInputKey = base.IsInputKey(keyData);
This does not appear to work, I have set keypreview on the form to true, that does not help.
I have tried this code in a dummy app and it works fine, and I have placed a break in the above code to see if the override is ever run - it isn't. There must be something in the rest of the code or a property that is stopping this.
Does anyone have any suggestions???? I am new to C# and have banged my head against the wall all day on this one!!!
I want to have a floating window in my app. One that is always on top of the main window...
But, if I make a form and set the TopMost property to true, the window is also on top of every other application.
I mean, when working in my app it works fine, but if i open another app in front of it, my floating window is also on top of that app... Not good...