Hi there lovely StackOverFlow helpers, I got into a bit trouble recently.
I need to make an application in WinForm C# as my final programming project. The project is about managing Registry more nicely to make it easier for the user to edit values.
So what I need is; to show all the Registry values of the same type, to show what the value does and to show their build. For instance: the hierarchical build is HKEY_LOCAL_MACHINE\SYSTEM\Keyboard Layout\Preload and the key 1 controls the keyboard loadout when your pc first starts (about presenting it, I'll probably use RichTextBox for the graphical way or something else I'll figure out).
So I assume there's a way the data is placed in the Registry, like all of the setting of the app is here and the prefrences is there..
I hope I was clear enough, thanks for all of your time to read and answer it!! I really REALLY appreciate the effort!
Related
How I can save the settings I want even after I close the program?
Let's say: If I have a Checkbox and I run the program. If I checked it I want to remain that way even when I reopen again the program. I hope you understand what I want.
I'm a newbie, so take me slow. Thank you.
I recommend using Application Settings Property Binding.
There are many options as mrunion mentioned in his good answer, but I think the most simple way in Windows Forms Application is using Application Settings Property Binding. To do so using designer:
Select your CheckBox in design surface
In properties window, at top, expand (ApplicationSettings), open dropdown for Checked property and select (New...) at bottom of dropdown.
Add your desired property with default value.
Save settings in somewhere like Form_Closing event:
C#: Properties.Settings.Default.Save();
VB: My.Settings.Save()
(ApplicationSettings) in property window:
Expanded from above....
To persist settings between different program runs, you will have to store that data somewhere for the user. Assuming since you mentioned VB, I will also assume Windows as your target platform. The best options are the following:
Use the registry to store the persistent data. There are plenty of tutorials on setting and retrieving registry variables.
Use a configuration/INI file for your application. Again, plenty of tutorials exist for this option.
Use a database. This is more advanced, but allows for the most flexibility of storing and retrieving data. I would suggest not using this method at first, and revisit it when you are ready to learn database design/querying/etc.
This should point you in the right direction.
I need to develop a winform with a treeview menu, localizable and with different options in case of each user (role and single-user based).
The only solution I can imagine is really unmaintainable:
Everything loaded and watched from database.
A table to define the menu (child-of...).
Every option in the menu should have a Form name to find and open it with reflection.
A table with translations to each language related to each option in the menu.
A table with permissions for each user and option (to show or hide it).
Is there any simpler solution??? I really don't want to do this kind of stuff 8-)
Thanks in advance.
We have actually implemented exactly what you are describing here (with the only difference being that we are using one language) and it works quite well. The fact that the menu can be altered at runtime has been used multiple times where any other implementation would have required a code release.
I am not sure why you say that it is not maintainable - the system has been in use for years now and we hardly ever need to spend time on the code that makes it all work.
A different system that I am involved in we build the menu at design time and then just have a lookup table with all the menu buttons in the database - it actually feels a lot easier to get something wrong there than when everything is in the DB.
I've been struggling for a long time with basic controls that Windows Forms offers to developers, but... right now, I am developing an application that requires more advanced control than normal "TextBox".
Since, at this time, my application is about memory management, I have to show in the form, the process memory in bytes (or other type of data) to the user, giving it the ability to modify it as he wants.
The problem comes here, because... if I show the data in a TextBox, it only allow me to display the data in read-only text because if I let the user modify the textbox directly, it will be very messy and unaesthetic.
I was reviewing some projects on SourceForge about C# and the handling of hexadecimal data, and i found a good project, called Be.HexEditor, which has a control developed and designed by its creators, but in GDI+.
The control is called HexBox, and that's just what I need to get.
Do any of you know how to develop a control like this?... I would greatly facilitate things. What kind of manuals/books should I read to learn this kind of development? I ask this because I ignore everything about GDI+.
Or... is there other way for do it?
I would use a textbox to show to the user the current value and another textbox to enter the desired value (maybe a slider will work better).
I think you'll find it's GDI+ that you have to learn
http://www.amazon.co.uk/GDI-Programming-Creating-Controls-Programmer/dp/1861006314
You may still be able to write controls in WPF and then include them somehow into your winforms app, but if you need to push pixels GDI+ is the only way.
I've been searching for days about this, but haven't found anything.
I am trying to find out how I can add a context menu item to the windows explorer. I do not want it for specific filetypes, BUT I want it to appear on everything inside a specific path.
For example, I want right-click menus of anything inside "C:\folder" to contain this item, but it shouldn't appear outside this folder...
Is that possible?
Any help will be really appreciated!
Thanks in advance,
John.
The normal way this is achieved is to add it to the Registry under:
HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell
However in your specific case you want to do some preprocessing before it is displayed (eg is it in the specified directory) which wouldn't work with a simple registry alteration.
I think there is a way to force you way into any operation and add a hook to it. I'm talking about old school knowledge now though and I cannot think what the technology would be called. I think its how you would have, for example, forced your way into the rendering engine to put custom skins on normal explorer windows or inject an extra button into the title bar of apps like you used to see back in the day.
It just occurred to me that adding a button to the windows title bar might have given a search starting point, I found this article which refers to subclassing windows components and injecting your own behaviour. I think that is what I'm talking about above:
http://www.codeproject.com/KB/wtl/titlebar.aspx
Hope this gives you a new direction to search in.
I'm starting my first C# project, and I want to make a "form designer" (like the one in VS).
The idea is, there will be a visual form designer with a limited toolbox, which will generate Python code (later more) to create the same form.
Problem is, I have no idea how to even get started. First of all, I have the form designer in VS: how do I make a "form-within-a-form?"
Next... I have no idea how complicated this is going to be. I suppose I could just make little boxes appear beside each control created on the form when it is clicked, for resizing, and make a textbox appear on it when double clicked or something, to change the text in it... Things like this.
So another thing I would like to know is this:
I do have programming experience in C and C++, I've done PHP for a number of years and am starting with Python as of recently. I've generated forms dynamically in VB6. Given this experience, am I in way over my head with this project?
this looks like a really good place to start. It has a pretty good example to get you started. You can even download his source (registration required).
It sounds like you're aware it's non-trivial for a C# first-timer. If you keep it pretty simple, it sounds like you're heading in the right direction (although a web-based form designer might be easier).
SharpDevelop would be an example of a full-featured IDE that can be re-purposed, but that's way over the top.
Good luck!
For most people starting out in C#, this project would be too much. With your VB6 background, you may be able to pull it off, though.
Here's a hint: the Visual Studio Windows Forms designer draws controls on its surface - by asking the controls to draw themselves.