|
|
The problem is, you're assuming he means logging (heck, I'm assuming it's a he - he could just as easily be she). This could also be log-in/out functionality.
|
|
|
|
|
Hi
I want a billion dollars
Thanks
|
|
|
|
|
Hi,
In my solution there are multiple projects like web, win services etc.,. all the are using the same Entetprices Library config informations and Connection strings. i want to place the same in a common file and wan to access in the individual project. how to do this?
Any one have Example codes pls post and explain! Thanks in Advance :-)
|
|
|
|
|
I write my own configuration files (in XML) for database connection stuff. Then other things I put in a configuration table in a database.
|
|
|
|
|
Hi all,
I am having .dat file which i am able to read but i am not able to write the data in to it in the following format "111,233,eewr,rwerwe".
How can i add the data to the .dat file.
Thanks in advance.
|
|
|
|
|
1- What did you try (please post some code) ?
2- What do you expect ?
3- What do you get (and where in your code does it occur) ?
|
|
|
|
|
Guys, i got stuck with the some functionality, which i really needed for a tool.. Can we create a ascx file at runtime??
My tool uses ascx file, to display a widget.. Now i want to create widgets at runtime, so i need to create ascx file runtime. Is this Possible any answers?? Please help me to move forward...
thanks in advance..!
|
|
|
|
|
You already asked this in the ASP.NET forum; please post in one place only.
|
|
|
|
|
I am trying to get the PorductID from HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\.
When I look at the registry through Registry Editor I see 21 name values contained including a key ProductID. When I list the key names in C# only 17 names are returned.
I thought that maybe I needed to run the program in administrator mode but still only got 17 names in the listing.
Does any one know why some of the names in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ are not listed when sought programmatically but appear in the registry editor?
modified 10-Oct-11 10:21am.
|
|
|
|
|
Four of the entries are different from REG_SZ.
Are these the four you cannot read? If this is the case you are probably trying to retrieve them incorrectly.
Please update your question with the relevant code on how you read the registry entries.
0100000101101110011001000111001011101001
|
|
|
|
|
Good observation about some of the entries not being REG_SZ, especially when 4 are not REG_SZ on your machine. On my machine 3 are not REG_SZ, but good observation anyway.
The one I am going for, ProductId, does have a type of REG_SZ, and I am trying to retrieve it using the following:
RegistryKey HKLM = Registry.LocalMachine;
String CurrentVersionPath = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\";
String ProductId = (String)CurrentVersionKey.GetValue("ProjectId");
Which works just fine with another item that is also has a type of REG_SZ.
String BuildGUID = (String)CurrentVersionKey.GetValue("BuildGUID");
Console.Write(String.Format("Registry value for {0}: {1}\n\n", "BuildGUID", BuildGUID));
Could you please try the following and see if you get all the items in CurrentVersion?
using System;
using Microsoft.Win32;
namespace RegistryValues
{
class Program
{
static void Main(string[] args)
{
RegistryKey HKLM = Registry.LocalMachine;
String CurrentVersionPath = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\";
RegistryKey CurrentVersionKey = HKLM.OpenSubKey(CurrentVersionPath);
if (CurrentVersionKey == null)
{
Console.WriteLine("Bad CurrentVersion registry key");
Console.Read();
return;
}
String[] names = CurrentVersionKey.GetValueNames();
Int16 i = 0;
foreach (String name in names)
{
Console.WriteLine(String.Format("{0}\t{1}", ++i, name));
}
Console.WriteLine("\n");
HKLM.Close();
Console.Read();
}
}
}
|
|
|
|
|
I just ran your code on my machine (XP) and all values were retrieved.
I also tried retrieving the value of ProductId and this also worked.
0100000101101110011001000111001011101001
|
|
|
|
|
I believe in XP the ProductId is in the Windows hive (not Windows NT as in Vista and Win7).
Do you have an entry for ProductId in the Windows NT/CurrentVersion/?
<edit>
I re-read your post and see that you do. Now I am confused.
</edit>
If I remember correctly in XP it is under Windows/CurrentVersion/ or possibly a hive under that.
Thanks for checking it out.
modified 11-Oct-11 12:34pm.
|
|
|
|
|
|
Thank you for the links. I will look into them when I get home from work.
|
|
|
|
|
hello im new here im currently working on a school project on the tittle above.
ive searched the net and the forum on the topic but i cant find any help
so can any programming experts here give me a sample coding of how to read temperature and accelerometer in c# ? if not, is there any guide around ?
thanks a million !
|
|
|
|
|
Without knowing what you're using for sensors and how they are connected to your machine, anything anyone posts could be worthless garbage. Such as, what radio types are you using? Are you using a mesh network? What protocols are you using? ..., ..., ...
Are you looking for the code to run on your PC to capture the data coming from the remotes? Are you looking for code to run on the remotes (which, BTW, won't be C# unless they run .NET Micro Framework)??
And since this is a school project, the chances of you being handed code are very, very slim.
modified 9-Oct-11 23:31pm.
|
|
|
|
|
The device you're using should come with instructions, or driver software/an API which you can connect to. You can use SerialPort[^] if it's a serial device, or you can use P/Invoke to get at the parallel port (for example this excellent article[^]) if it's a parallel device.
If there's an API available, use it, possibly through COM interop or P/Invoke declarations if it's an old school DLL.
|
|
|
|
|
Greetings Gurus,
I need an event to fire at set times during the day from a Windows service.
Code so far
protected override void OnStart(string[] args)
{
if (DateTime.Now.TimeOfDay == System.TimeSpan.Parse("09:00:00"))
do something
but I would like it to run at 13:00, 17:00 & 21:00 too.
What is the correct syntax please as I can't find any examples of how to do this. I don't want it to run every 4 hours (e.g. 01:00, 05:00) so I would prefer not to use a static schedule.
I would also like to add an event log entry if the service didn't run at the scheduled time so that it could be investigated but am not sure about how to go about it.
Could you help please?
|
|
|
|
|
I've done a similar process in the past by setting up tasks on a background thread that get run at the appropriate time. These threads are then put to sleep until the appropriate point, when they wake themselves up and perform their task. Upon completion, the thread is put back to sleep until the same time the following day. The beauty about this approach is that the only loop you need to put in place is the one that kicks it off in the first place, and closing down the service should just involve shutting down the sleeping threads.
When I wrote this, I used a Mutex and based the sleep interval on a TimeSpan .
|
|
|
|
|
CCodeNewbie wrote: if (DateTime.Now.TimeOfDay == System.TimeSpan.Parse("09:00:00"))
Don't use equality tests on (almost) continuous types, such as DateTime, float, double. Two independent values will hardly ever be equal, DateTime may have a resolution of 1 Tick, i.e. a tenth of a micro-second. Either use a simple greater-equal test, or perform an interval test.
|
|
|
|
|
What I have done in the past is to have a Windows Service cycle every second or ten that scans a database table for tasks that are due and runs them.
CCodeNewbie wrote: I would also like to add an event log entry if the service didn't run at the
scheduled time so that it could be investigated but am not sure about how to go about it.
That's just silly. Why log something when it could run the task instead?
|
|
|
|
|
Hi, I have a panel and custom controls on it. I know how to select multiple controls by clicking on an empty space on the panel and move the mouse but how can I do it if the panel is covered fully by controls and not visible?
All I want is to click on any of the controls and drag the mouse on the other controls to select them. Any clue would be appreciated.Thanks
|
|
|
|
|
Does Ctrl+Mouse-click work?
0100000101101110011001000111001011101001
|
|
|
|