|
Hello All,
I'm getting a value from a registry key that is of type REG_MULTI_SZ and I can't display it on the screen. Consider the following:
Console.WriteLine(_remoteRegKey.GetValue("Foobar").ToString());
This is the output I'm getting:
System.String[]
Can anyone enlighten me as to how I can get the value of the key ? Thanks in advance...
-Koby
|
|
|
|
|
It passes back an array of strings. Try, iterating it and displaying them individually...
|
|
|
|
|
Not sure that this will work, but something like this might.
for(int i = 0; i < _remoteRegKey.GetValue("Foobar").Count; i++)
{
Console.WriteLine(_remoteRegKey.GetValue("Foobar")[i].ToString());
}
Someone please correct me if I am wrong. James, I know you are lurking out there.
Nick Parker
|
|
|
|
|
I think you'll need to use this code since GetValue() returns an object;
string [] values = (string []) _remoteRegKey.GetValue("Foobar");
for(int i = 0; i < values.Length; i++)
{
Console.WriteLine(values[i]);
} James
Simplicity Rules!
|
|
|
|
|
Thanks James, I had been up for countless hours last night due to those damn finals. That is all over now, so you don't have to worry about me posting incorrect information now. Sorry for any of those that I mislead.
Nick Parker
|
|
|
|
|
I would like to make winform has the same behavier as Microsoft windows does, when user press Ctrl+C, it will copy the selection into a clipboard, and can use Ctrl+V to paste it to somewhere. Anyone knows how to achieve it?
thanks
chris#
|
|
|
|
|
Nish has written an article on Code Project that should show you how to implement the Clipboard class in your application. Here is the link in a new window. Clipboard handling with .NET
HTH
Nick Parker
|
|
|
|
|
Great! It helps a lot! However, I still have a question in mind: how about copy an object array, and paste it to somewhere? I have a ListView control in a form, contains several objects. I want to be able to copy multiple of them, can I do it? And if their type is not listed in dataFormats list, how can I retrieve them? Thanks again!
Chris#
|
|
|
|
|
I'm finding that it would be very useful to have a class property that would accept multiple entries. For example, I want to have a property that keeps track of 5 toolbar buttons automatically for me. So, I want to create a property where I can automatically get/set the toolbar collection via the IDE.
The following code 'almost' works. The property appears, I can click on the "..." button and the Collection Editor appears, but it doesn't save anything. The word "(Collection)" doesn't appear in the property.
Are there any examples out there that show how to do this?
[Category( "Controls" )]
[Description( "Add the list of ToolBarButtons that keep track of the modes" )]
public ToolBarButton[] ToolBar_ButtonModes
{
set{ m_ToolBar_ButtonModes = value; }
get{ return m_ToolBar_ButtonModes; }
}
private ToolBarButton[] m_ToolBar_ButtonModes = null;
-- Thanks!!
|
|
|
|
|
Just a hunch, but usually if you want to tell the IDE something about your properties, you need to use Attributes. Maybe try the Designer attribute, and pass it the standard ToolbarButton[] designer (if such a thing exists). Or maybe there is a CollectionType attribute.
Just guessing
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
I know that Code Project has a *utility* for transforming code for articles into the correct color format. Has anyone seen/written a class to do this for the new .NET Framework, if not I am seriously considering this as a new project in C# (after the screensaver that is )?
Nick Parker
|
|
|
|
|
I want to create something similar to the C# Form Designer include in the C# IDE but not too advanced, I just want to know how can I lock a Form in my Main Application Window, anybody know how to make something like this ?
thanks.
BTW, is it possible to create a DLL with the other dll I need to create an application like System.DLL, System.Windows.Form.DLL all those DLL include in one So after I can only compile my program using this DLL ??? if yes how can I do this ?
Thanks Again
|
|
|
|
|
BLaZiNiX wrote:
I want to create something similar to the C# Form Designer include in the C# IDE but not too advanced, I just want to know how can I lock a Form in my Main Application Window, anybody know how to make something like this ?
From what I can tell the VS.NET forms designer actually loads the form up into a temporary app domain and displays it in the window. To display a Form inside another form use this bit of code.
Form childForm = GetFormToDisplay();
childForm.TopLevel = false;
childForm.Location = GetLocation();
this.Controls.Add(childForm); You'll also have to hook several messages using Application.AddMessageFilter so that the child form can't be moved around (NCHITTEST plus some WM_SYSCOMMAND).
I have another message here that explains how to use Application.AddMessageFilter
James
Simplicity Rules!
|
|
|
|
|
k i will try to code it, if I need help again I will post another msg
BTW do you know how can I (suppose I have a button control) remove some property in the PropertyGrid and replace it by my own. In my application, I add a propertyGrid and I want to show only some property for some controls, how can I do this ?
Thanks Again James
|
|
|
|
|
BLaZiNiX wrote:
BTW do you know how can I (suppose I have a button control) remove some property in the PropertyGrid and replace it by my own.
Without creating your own class derived from PropertyGrid you can't replace specific properties with your own.
The property grid shows all properties with a BrowsableAttribute set to BrowsableAttribute.Yes. So you could create your own psuedo-button class that encapsulates a Button, and pass that as the SelectedObject in the property grid.
James
Simplicity Rules!
|
|
|
|
|
I believe you will need to do a childForm.Show() on that also. The Forms framework doesn't seem to do it for you.
I used this technique a little while back to implement a Wizard97 look-a-like that allowed users to design their own forms and feed it to the primary Wizard form (sheet), all the wizard had to do was adjust a few properties and drop it into the mix, works well.
Regards
|
|
|
|
|
Neil Van Note wrote:
I believe you will need to do a childForm.Show() on that also. The Forms framework doesn't seem to do it for you.
LOL, yeah I always forget that; then wind up going over my code three times trying to find the bug
Simplicity Rules!
|
|
|
|
|
Every time...
|
|
|
|
|
do you think you can send me a sample code of something like your Wizard app ?
at this moment it's going well but I think I will have problem later
Thanks
Jonathan Pouliot
|
|
|
|
|
Well, if you follow James instructions above, it should do you pretty well. I really don’t feel right about releasing my code for this just yet, as it’s running in a current client’s system.
Just shout when you need assistance and one of us will push you in the right direction, or possibly someone reading this may have something similar that they are a little more free to share.
A word of caution up front though, in the current release of the .NET framework, forms created in this manner do not receive their OnClosing/OnClosed events naturally, and you should probably issue a Close on them manually when the container form receives its notification. A second solution, which I used, was to issue a custom set of Wizard related events to signal that the parent was about to close and it was time for the form(s) to cleanup. Using this method protects my code from issuing a second Close, just in case the boys and gals over at MSFT decide to fix the issue. The dispose methods do get called regardless.
Regards
|
|
|
|
|
the only thing it's after the user create the form dynamicly I want to include action on some controls like buttons and I want to compile all the form with the controls action in one file *.cs and after compile it to an exe.
What I want to know it's how can I create the CS file to add the action and the form design in, like VC# does ?
Thanks
|
|
|
|
|
My wizard solution is something used by the clients developers, so it is more of a component than an application builder.
Just out of curiosity, and I am definitely not the one that would try to stifle your ambition, but why are you trying to reinvent the wheel that was just built?
It would seem to me that if you expose a good object model, extending an application built with .NET would be trivial without all of this, just having the clients developers use .NET to build extensions. Or are you looking for a mini environment like VBA in outlook?
Regards
|
|
|
|
|
I'm creating a Trainer Maker and I need to use a Form designer and I need to compile the form the user will create and I need to include some action like retreive the Textbox text to use it for a value and add Buttons action like to poke and freeze that's it.
I want to make something similar to Trainer Maker Kit (try to look at this application,check for screenshot, if you want of course), it's in VC++ i think and I want to make something that can equal the perfection of this program. Of course with the .NET Technology.
at this moment the form Designer works fine the only "hic" it's for that .CS file creating dynamicly. I'm suppose that is almost the same way as the C# IDE does, but i don't know very well how can I remake this. I don't want to make something big just a little file with the Window Form Designer code for all the controls and the action I will put on the controls.
I will check how can I figure it out, but I think I will post a lot of question on this board I hope I don't bugging you with all my questions, if it's the case just tell me please
Thanks
|
|
|
|
|
I think there is a sample in the C# section called LiveCode.NET that does something similar. I havent checked it out yet, but I am sure you have seen it in any event...
|
|
|
|
|
Oops, I don't think I ever posted that message explaining Application.AddMessageFilter
AddMessageFilter takes an instance of the IMessageFilter interface, it has one method, PreFilterMessage which works like the WndProc except it returns true if the message has been filtered and doesn't need to be processed anymore.
So to use it:
public class MyClass : ......, IMessageFilter
{
bool IMessageFilter.PreFilterMessage(ref Message m)
{
return bShouldContinueProcessing;
}
} Then when you want to add it to the Message filter, Application.AddMessageFilter(myClass as IMessageFilter);
BLaZiNiX wrote:
BTW, is it possible to create a DLL with the other dll I need to create an application like System.DLL, System.Windows.Form.DLL all those DLL include in one So after I can only compile my program using this DLL ??? if yes how can I do this ?
Nope, not with strongly-named assemblies they cannot be modified since a checksum is used to ensure they haven't changed.
There is a utility out there somewhere for combining multiple assemblies into one, but it can't be used on strong named assemblies because of the previously mentioned reasons.
I forget the name of the utility; maybe Rama Krishna remembers it (it was mentioned on the dotnet list not too long ago; if i remembered the context I could look it up).
James
Simplicity Rules!
|
|
|
|