|
Hi all,
First some context to my question:
I am working on a utility that queries the Windows registry for a large number of keys set by a particular application.
I am using multiple DataGridView (DGV) controls to display the information (Reg Key and Value) on my form. Each DGV is tied to a Dictionary using a BindingSource.
This has worked out fine for all sets of keys except for one.
- This application has provision for 10 different user-profiles.
- Associated with each user-profile are 7 SETS of feature keys.
- At any given time, the user needs to see the settings for only ONE of the 10 profiles.
- On my form, I have a collection of radiobuttons that I use to select a profile.
PROBLEM:
1. Should I use an array of dictionaries (dimension 1: profile; dimension 2: feature)? If so, how do I do this? If not, what is a better solution?
2. Can I have only 1 set of DGVs (representing the feature keys), so when I click between profiles, the DGVs are updated with the values for that profile?
Thanks for your help!
|
|
|
|
|
0) The registry is evil, don't use it.
1) DataGridView is evil and likely an inappropriate control for your purpose.
2) The registry is a tree, why not use a TreeView?
|
|
|
|
|
PIEBALDconsult wrote: The registry is evil, don't use it.
Unfortunately, I have to
class="FQA">PIEBALDconsult wrote: 1) DataGridView is evil and likely an inappropriate control for your purpose.
Not sure why the DGV is so evil but it does work quite nicely for the purpose of my project.
PIEBALDconsult wrote: 2) The registry is a tree, why not use a TreeView?
I will look into using a TreeView... I did not know about this when I started working on my utility and I have the information displayed the way it is required. However, it might not be too late to rethink this design... thanks for the tip!
|
|
|
|
|
The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities.
A list of dictionaries is probably appropriate.
You can only have one set of controls, and switch their data sources when the profile changes.
|
|
|
|
|
BobJanova wrote: The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities.
Yes, they are.
BobJanova wrote:
A list of dictionaries is probably appropriate.
You can only have one set of controls, and switch their data sources when the profile changes.
Thank you! I will look into the list of dictionaries.
|
|
|
|
|
Hi Bob,
I have a follow-up question. Is there a way for me to avoid declaring 10 * 7 = 70 dictionaries? 10 is the number of use-cases and 7 is the number of dictionaries I would require for each use case.
I have a group of radio controls (gb_profiles) on the GUI and have been able to edit its CheckedChanged function to derive the index of the control that has been checked.
private void rb_prof_CheckedChanged(object sender, EventArgs e)
{
foreach (Control ctl in gb_profiles.Controls)
{
if (sender.Equals(ctl))
{
profile_selected = gb_profiles.Controls.IndexOf(ctl);
}
}
}
How do I use this to load the dictionary with only the values for this profile?
Thanks for your help!
|
|
|
|
|
Would you ever have more than one use case open at once? If so, I don't see how you can avoid declaring dictionaries for each use case, and within each one you would have a dictionary for each option. (You could do some lazy loading and caching but honestly for a reasonable sized registry key it is nit worth it.)
|
|
|
|
|
I will not be displaying more than one use case at once. However, the user will have the option to save the results of the registry key to a file (I think I am going to go with XML for that).
Given this, it appears that I might have to declare dictionaries for all these use cases...
|
|
|
|
|
I am using a dll called "EPPlus.dll" in my code and I want to wrap it into the executable.
http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx[^]
Using the post above, it appears to be possible but my code below is failing. I'm not 100% on how the string resourceName is supposed to play into this, can anyone offer advice on how to get this code to work with EPPlus.dll? Thanks for reading.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Reflection;
namespace QCVerification
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainVerification());
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
String resourceName = "AssemblyLoadingAndReflection." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
Byte[] assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
};
}
}
}
|
|
|
|
|
|
Hi,
I'm unsure of why it did not work for me (I do have the case correct) and knew I had to be doing something wrong ...
First I tried
String resourceName = "EPPlus.dll";
Then I tried
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EPPlus.dll"))
and finally I tried
AppDomain.CurrentDomain.AssemblyResolve += (sender, "EPPlus.dll") =>
Should it be? (I'm not at work to try this)
String resourceName = "AssemblyLoadingAndReflection." + new AssemblyName("EPPlus").Name + ".dll";
|
|
|
|
|
Make sure to include the namespace with the resource name.
Working with Embedded Data[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yup, that looks like what I was missing.
Thank you Mark!
|
|
|
|
|
You're welcome
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi
I wish evry body is OK
today I have Q about screen resolution I wish from any one have
I dea about it to answer my Q this is My q
* If send drawing image(bitmap)from on PC(big Screen)to another PC (small screen) Over network connection
Some of drawing not appear in another PC *
**But Iam send only Drawing points and color Iwant function to calculate screen bound or panel that i drawing on it to send it ****
that is all I wish get it thanks***********please if u Don't Know don't give me advice to go to google
Iam going beffor but not get anything*************
|
|
|
|
|
Don't have an answer for you problem but do have a small bit of advice. Don't text speak here. It gets viewed less than pleasantly. Type as if you are on a professional forum, not as if you are texting your buddy across the way.
Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning.
A crisis on your part does not constitute one on mine.
|
|
|
|
|
That is not a very helpful question.
1) To back up what gavindon said: don't use text speak - you have a keyboard, either learn to type or just learn where the vowels are and start using them. The space bar helps as well. Would you appreciate it if someone gave you a code answer with half the characters missing?
2) Do you really think large numbers of '*' characters help? All they do is make your question look like it has been censored.
3) Have you checked the resolution of the two screens? Is the "small" one big enough to display all the pixels on the "big" one?
4) How do you expect us to help your improve your code if you don't actually post the relevant code fragments? Psychic powers?
5) If we don't think you have actually searched, then you will indeed get told to google off - trying to limit the advice we give you to "acceptable" answers by your definition will both annoy those you want to help you, and restrict our choice of answers. Sometimes the advice we give is not what you want to hear - doesn't mean it is not good advice.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Is your question, how do I get screen resolution locally on a computer, when this computer starts my application locally?
If so, the function below should help get you started. This will give you resolution even if you have multiple screens. Using this, you could resize a picture if the resolution is set to less than a certain number.
The other posters were correct about the l33t speak.
private static void test()
{
string virtualWidth = "";
string virtualResolution = SystemInformation.VirtualScreen.ToString();
string[] virtualResolutionSplit = virtualResolution.Split(',');
foreach (string resolutions in virtualResolutionSplit)
{
if (resolutions.Contains("Width="))
{
resolutions.TrimStart();
resolutions.TrimEnd();
virtualWidth = resolutions.Replace("Width=", "");
}
MessageBox.Show(resolutions);
}
}
|
|
|
|
|
|
Hi Guys,
i have a website that allow my client to login and apply for staff so upon sending the application i recieve an email that tells me a user has add something..
so i want to use a link from an email to auto login to my site and access the page that m willing to access. i use the following to send the email
XmlDocument xml = new XmlDocument();
xml.Load(HttpContext.Current.Server.MapPath("../Templates/NewCorrespondent.xml"));
string emailXML = string.Format(xml.OuterXml,aprov.CompanyName,aprov.CompanyType,aprov.VatRegistered,aprov.vatRegistration,url());
string emailBody = WebUtilities.Transform(emailXML, HttpContext.Current.Server.MapPath("../Transforms/NewCorrespondent.xslt"));
string table = (CompanyDetails(USRID) + "" + emailBody);
messaging.sendEmail(SupportEmail(), "New Correspondent Has Been Created", table);
|
|
|
|
|
Do you have a question or are you just sharing code.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
No. It's a description of the application.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
As English may not be your primary language I'll give you a hint. Questions contain statements such as, How can I do X, or, I would like to be be able to... and are followed by a question mark (?)
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
If the user is logged in, a cooky would be set. If the browser opens and the cooky is valid, there wouldn't be a need to login. Hence, clicking the link would open it, as if the user is logged in.
Providing a link with an embedded password would be less secure.
Bastard Programmer from Hell
|
|
|
|