|
I need to change a registry value using a console c# app. I am getting an error though but from what i see, the code is alright, any suggestions?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
namespace ChangeHomepage
{
class Program
{
static void Main(string[] args)
{
RegistryKey rkHKLM = Registry.CurrentUser;
RegistryKey rkRun;
String site = "whatever site";
String regPath =("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main");
rkRun = rkHKLM.OpenSubKey(regPath, true);
rkRun.DeleteValue("Start Page", true );
rkRun.SetValue("Start Page", site, RegistryValueKind.String);
Registry.CurrentUser.Flush();
}
}
}
|
|
|
|
|
MitchG92_24 wrote: I am getting an error though
Sharing the details of the error message will help us to help you...
|
|
|
|
|
Hello
I have an application that is basically built on Tab control. I have 8 tabs and i need to have different domains(e.g Admin, clerk, bursar, secretary) on my login where when a user under a specific domain clicks on a certain tab, an event is generated that prevents him from viewing the content of that tab
Any advice please???
|
|
|
|
|
It will be better to define different roles & privileges; Then we can show / hide different tabs based on the privileges of the logined user.
|
|
|
|
|
Please give me a simple guide line...
Thank you
|
|
|
|
|
Web app, or desktop? (It helps to be precise in your initial question.)
|
|
|
|
|
It is a desktop application
|
|
|
|
|
Okay, so you need to manage roles yourself, unless you want to use the standard Windows account properties. I think you can get the group name and you can definitely get the domain and user name.
|
|
|
|
|
I was thinking of it this way...
private void Form1_Load(object sender, EventArgs e)
{
if ((Thread.CurrentPrincipal.IsInRole("admin")))
{
tabPage4.Hide();
}
else
{
MessageBox.Show("You must be a member of the Manager or Administrator's roles to view username and password information", "Insufficient Permissions",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
But now instead of
CurrentPrincipal.IsInRole put something that will read the domain name. Something of that sort.
I'll appreciate any help
Thank you
|
|
|
|
|
Hi,
I would like to know:
1.what happens when you add a reference to a Class library in dotnet.
2.Is it something like a "implicit" linking in C++?
3.Can I make the library statically link to the exe?
4.And does the dll in dotnet internally have implementation for DLLAttach, Detach?
|
|
|
|
|
1. It is similar to compile-time linking in C++ in that the CLR automatically loads the library
2. A little bit.
3. No. The CLR takes care of runtime loading and linking automagically. You are not allowed to have anything to do with it.
4. All necessary runtime loading and linking is taken care of by the CLR.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thanks for the reply mate.
I'm trying to look into the internals of managed world.
The document says "CLR is hosted"? Does that mean CLR is per process stuff? is it not system wide?
|
|
|
|
|
The CLR is 100% a user mode component. No kernel mode stuff at all.
Technically, the CLR maintains a single process space, and all .NET "processes" are segregated within that one process space. These are called Application Domains. The fact that they are really within the same process makes inter-application communication much simpler and faster.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thanks for the reply Richard.
I'm trying to dig a little deep into it but most of the links show up a blunt high level Block diagrams , explaining the stacks in the framework.
I need to a pointer to understand low level details of how CLR is invoked to deal managed Applications.
Anywhere you can point me to?
I want to know: When I execute a managed App, how does the OS route the exe to the CLR?
Or CLR is mapped to every process? If CLR hosts all the managed Apps as domains? then how does it over ride 4GB limit per process in a 32bit system?
|
|
|
|
|
Yes, those certainly are important questions.
I'm not sure where to find such detailed information. Perhaps the MSDN blogs?
Good luck.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Working with Visual Studio 2008. My tutorial indicates that when a SQL database is created the solutions explorer changes to the database explorer.
The view changed on the first attempt but has not been seen since. Looking for guidance for troubleshooting if necessary. Or... was the view only shown first creation. Guidance sought
|
|
|
|
|
Sounds like a Visual Studio question, not a C# question.
|
|
|
|
|
Much thanks for your reply. Please know that I checked the discussion list and did not see Visual Studio. Woudld be so appreciative for a link.
* Just saw Visual Studio in this forum for the first time. Much thanks
Cordially,
mauricemcse
|
|
|
|
|
It's the one bottom left titled "Visual Studio".
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
View menu -> Server Explorer.
|
|
|
|
|
I want to get the selected/highlighted text from any application through c#. I know one way to get it is to copy it to the clipboard. But what I want my program to do is that when I display an Hotkey(will decide later) the highlighted text should be displayed on console/Messagebox. Just like we see in applications like Wordweb.
|
|
|
|
|
Register a global hotkey. In the key down/up event, get the window handle of the respective window and send a WM_GETSEL message to it. Note: this may fail with Java swing applications.
|
|
|
|
|
Hi All !
I want to Import an Excel File to a DataGridView as FirstRow (Except A1 Cell that's null)will be Column HeaderCell in DataGridView and First Column in Excel file (Except Cell of A1=null) will be Row HeaderCell in DataGridView .Here is my code :
string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDialog1.FileName);
string query = String.Format("select * from [{0}$]", SheetName);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connectionString);
DataSet ds = new DataSet();
dataAdapter.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
int row = ds.Tables[0].Rows.Count;
int col = ds.Tables[0].Columns.Count;
for (int i = 0; i < row - 1; i++)
{
dataGridView1.Rows[i].HeaderCell.Value = ds.Tables[0].Rows[i].ToString(); ;
}
for (int j = 0; j < col - 1; j++)
{
dataGridView1.Columns[j].HeaderCell.Value = ds.Tables[0].Columns[j].ToString();
}
But I have some Problem for Header Column And Header Row .
Thanks For Any Help .
|
|
|
|
|
Importing via an OLEDB connection only works on a well formed excel file/table. If you are having trouble then it is highly likely that the excel file is crap (as usual). Throw a break point after the fill and see if there is some data.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|