|
Some people have suggested that the UAC might be the problem here, and it could be if you don't force your application to be run under the admin account.
But, try this as well: When you open the myRegKey make sure you open it for both reading AND writing. This is done by using the OpenSubKey method like this:
myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true);
(You left out the second parameter..)
Good luck!
|
|
|
|
|
It is not working.
Can u give me sample code?
|
|
|
|
|
Hi all,
i want to receive official emails in my C# application.
can any one help me ?
Regards,
Sunil G.
|
|
|
|
|
|
Please guide me to develope a small application which uses RS422 for communication
how the communication could be done in Vc
how to implement the RS422 protocol
|
|
|
|
|
Hi,
maybe this article is a good first step:
Pelco P and D protocol implementation in C#[^]
As far as I understood you will also need an adapter (hardware) to generate RS422 signals (because there is a electrical difference to the default signals).
Regards
Sebastian
|
|
|
|
|
This Document[^] is an instruction manual for implementing the RS422 protocol and interface. This site[^] explains some of the issues involved in implementing the interface.
RS422 is a hardware spec, however, and does not discuss the software. It defines a multidrop serial link that extends the RS232 standard, as does RS485. Managing the serial port is accomplished using System.IO.Ports[^] in the .Net Framework. The SerialPort class allows pin-level access to the serial port, and appears to provide state management, as well (I haven't used it yet, so I'm no authority).
I would assume, if it was my project, that the target devices use the same control protocols as RS232 for data stream management, and write the code accordingly. The only exception would be that, since RS422 implements a multidrop serial communications scheme, there must be some addressing function defined. That may be device-specific, or industry defined. The manual mentioned above probably contains that information, though being after midnight here, I haven't read it. Translating RS232 signals into RS422 signals is a job for a hardware adapter.
By the way, the second link above is to B&B Electronics, whose catalog contains an excellent technical reference describing in detail the various serial interfaces in use today - I recommend that you request a catalog if you're going to be doing much of this stuff. Their primary business is selling adapters to convert the various serial communications standards to other forms.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi,
I have an application that sends emails to user using the SendMail() API in C#. The code is working is fine. I wanted to authenticate the username and password to a mail server without calling the SendMail(), just authentication. Is there a way to achieve this. I saw a "Test Account Settings" button in the outlook which does the same thing, It checks for the connection to the Mail server, Logon to the mail server and finally sends a test message.
Feel free for any clarifications.
Thanks in advance.
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
|
I have been struggling for a long while now trying to get a simple table to display in a data grid view on a C# windows form.
I believe I am doing something wrong but...I can't see where I am straying. All of the examples and sample files essentially tell me to create a new data source and then drag the table I want to use onto the forms designer and wa-la! but it isn't working for me. I can preview the data in the table and I see the records there, but running the form shows a blank grid and a -1 shows when I click in the grid.
Can anyone lend some advice? I am using VS2008 SP1 and Access 2007 on a Windows7 machine. I also tried with the exact same results SQLExpress 2008.
Jeff
|
|
|
|
|
Hi,
maybe the bind-command is missing within the source code. Could you post a bit of your code? Maybe the code within the designer.cs where the grid is constructed.
For a detailed example have a look here:
http://69.10.233.10/KB/vb/DataGridViewEditForm.aspx[^]
Regards
Sebastian
|
|
|
|
|
If I understand correctly,
below is the code from the frmMain.designer.cs file. I am a bit confused over this whole thing as to what does what and why. If you have a good reference resource that might help me I would appreciate it, so that I don't use too much of your time. I have Murach's C#2008 and SQL Server 2008 for Developers as well as a number of older MS Press books for C#. The MSPress books are all quite dated and a bit sparse for database information.
<pre>//
// tasksBindingSource
//
this.tasksBindingSource.DataMember = "Tasks";
this.tasksBindingSource.DataSource = this.timeSheetDataSet;
...
...
...
//
// tasksDataGridView
//
this.tasksDataGridView.AutoGenerateColumns = false;
this.tasksDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.tasksDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn1,
this.dataGridViewTextBoxColumn2,
this.dataGridViewTextBoxColumn3});
this.tasksDataGridView.DataSource = this.tasksBindingSource;
this.tasksDataGridView.Location = new System.Drawing.Point(36, 195);
this.tasksDataGridView.Name = "tasksDataGridView";
...
...</pre>
Thanks for the time and the help.
Jeff
|
|
|
|
|
Hi Jeff,
I was searching the missing DataBind()-method call as carlecomm already suggested. So I guess using the answer of carlecomm it worked.
There are plenty of examples around but I would suggest you take a look at the msdn sample:
http://msdn.microsoft.com/en-us/library/1x64c23x.aspx[^]
Regards
Sebastian
|
|
|
|
|
Hi, guy, there are codes bellow, you can try to bind GridView firstly.
dataGridView1.DataSource = datatable1;
dataGridView1.DataBind();
modified 27-May-14 5:05am.
|
|
|
|
|
Thanks for the advice, but...
I am not sure how to implement your samples. I am using the "built in" features that generate the code automatically and it looks like the lines you suggest are being called... except for the DataBind() function. it doesn't appear to be an option for this grid control.
Thanks again for the help
Jeff
|
|
|
|
|
Hi all,
I need to process a list of opened excel files. The excel files are already opened by user, and not through any code(at least not through my C# code).i.e if a user has opened 2 excel files, I need my code to detect these 2 opened excel files.
I have tried "google" the problem, but...
Thanks.
|
|
|
|
|
Will your program be - or can it be - running when the user opens the files in Excel? Do you know the location from where they will be opened, for example if they are all in the same folder or some known set of folders? If yes to both you can use a FileSystemWatcher and know when the files are opened that way (or saved, for that matter). You won't know just from this what app they opened the file with, but depending on your scenario this could be enough.
By the way, it seems to me to make more sense to process the files when they are saved than when they are opened. Multiple processes cannot write safely to the same file at the same time without synchronization, so unless the user always opens the workbooks read-only you already have a fundamental problem right here to solve before trying to find out the details of how to do things.
|
|
|
|
|
"Will your program be - or can it be - running when the user opens the files in Excel?"
Yes can be running but it doesn't matter what/which file opens because I need only those files that were open when my code was run.
"Do you know the location from where they will be opened, for example if they are all in the same folder or some known set of folders?"
No. It could be from anywhere on the machine.
As for the last part, I am not worried about synchronization, because it is taken care of. All I need is a snapshot of the files opened by a particular application at a point of time when the code is run.
thanks...
|
|
|
|
|
where can i download the crystal report?i download some ,but it do not work!thanks everyone!
|
|
|
|
|
miss YY wrote: where can i download the crystal report?
http://www.crystalreports.com/[^]
and this is the c# forum - thats a bit different to 'Crystal Reports' .. I suggest if you license the product you go back to the support service if you have other issues with the product itself - of course if you get the software from a dubious source, dont license it etc etc, you deserve everything you get IMNSHO ...
'g'
|
|
|
|
|
Hey,
I am running into a weird problem. I am using below method to extract country location based on IP address.
if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
{
m_IPAddress = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else if (HttpContext.Current.Request.UserHostAddress.Length != 0)
{
m_IPAddress = HttpContext.Current.Request.UserHostAddress;
}
DataTable dt = GetLocation(m_IPAddress);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
m_IPCountry = dt.Rows[0]["City"].ToString() + "," + dt.Rows[0]["RegionName"].ToString() + "," + dt.Rows[0]["CountryName"].ToString() + "," + dt.Rows[0]["CountryCode"].ToString();
}
else
{
}
}
private DataTable GetLocation(string ipaddress)
{
WebRequest rssReq = WebRequest.Create("http://freegeoip.appspot.com/xml/" + ipaddress);
WebProxy px = new WebProxy("http://freegeoip.appspot.com/xml/" + ipaddress, true);
rssReq.Proxy = px;
rssReq.Timeout = 2000;
try
{
WebResponse rep = rssReq.GetResponse();
XmlTextReader xtr = new XmlTextReader(rep.GetResponseStream());
DataSet ds = new DataSet();
ds.ReadXml(xtr);
return ds.Tables[0];
}
catch
{
return null;
}
}
when i try to catch the exception i get error msg "The remote server returned an error: (503) Server Unavailable."
the website is hosted in australia. I am logging all the details in database. IP address is correct at all time just after midnight in australia i am able to get country information while during the day it becomes null. any idea what am i doing wrong. probably need to add something in web.config?
modified on Tuesday, January 5, 2010 8:47 PM
|
|
|
|
|
I cut and pasted your url [http://freegeoip.appspot.com] into a browser and received :-
"App Engine Error
Over Quota
This Google App Engine application is temporarily over its serving quota. Please try again later. "
so is there a possibility its being hammered at some stage of the day and when you want to access it its already 'over quota' ?
'g'
|
|
|
|
|
is there a work around to get a country details based on IP without using this service?
|
|
|
|
|
undoubtedly there are other services 'out there' or other databases - wether they are free or not, remains to be seen
'g'
|
|
|
|
|