|
I've been doing a lot of service installations from a WinForm, and I prefer to use the methods in advapi32.dll via p/Invoke. Check out the methods:
OpenSCManager
CreateService
CloseServiceHandle
|
|
|
|
|
|
|
Hello!
Is it possible to lit the num, caps and scroll lock light on a regular keyboard with a C# program?
|
|
|
|
|
|
|
You can read the state easily, but to set/toggle it requires some PInvoke I believe. There's a MS article here[^] with code in VB as an example.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
In case you haven't solved your issue completely - I have posted an article on this subject that is a full solution, dealing with many problems that I encountered that you may not yet have come across.
Thanks for your post, it inspired the article!
Toggle Keys Controller Article[^]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thanks!
Tried to understand your solution, but it's maybe to advance for me, not much code-comments either.
But your solution proves that it's possible to do lit the keyboard lights with a C# program. Now I know it's possible
|
|
|
|
|
If you either copy the files in the Keyboard project into your own, or add a reference to the Keyboard.dll file to your solution, you don't need to worry about how I've implemented it - you can just use the properties, events and method(s) of the ToggleKeyController class as I have done in the demo (if you look at the code in FormMain.cs).
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hello All ,
I have requirement that User will have list of Directories . the moment user selects a Directory
Thread s hould be started and It s hould display List of Txt files name and dates in Grid .
User can change the directory and the thread should show the files of that directory in grid
I have done the code like this
public static DataTable GetFilesinDirectory()
{
DriveInfo Drive = new DriveInfo(strDriveName);
DirectoryInfo[] DirectoryList =Drive.RootDirectory.GetDirectories(strDirectoryName);
DtFilesList.Rows.Clear();
// DtFilesList.AcceptChanges();
FileInfo[] FilesList = DirectoryList[0].GetFiles("*.txt");
foreach(FileInfo ObjInfo in FilesList)
{
DataRow drFileInfo = DtFilesList.NewRow();
drFileInfo["Name"]=ObjInfo.Name;
drFileInfo["CreationTime"]=ObjInfo.CreationTime;
drFileInfo["Extension"]=ObjInfo.Extension;
drFileInfo["LastWriteTime"]=ObjInfo.LastWriteTime;
DtFilesList.Rows.Add(drFileInfo);
}
return DtFilesList;
}
This method is assigned to thread
strDirectoryName will be updated once user selects the Directory
But problem is Since it is Static method I cant acces the Grid then how should i Bind ?
|
|
|
|
|
Hi,
if static were the problem (I'm not really sure), why don't you drop the static keyword? A thread does not require its runner method to be static.
|
|
|
|
|
Okie Let me tell the requirement ..
A thread should be there which will pool a folder for every 5sec and show the list ofiles in grid with the new changes
|
|
|
|
|
I see no problem (maybe that's because I don't read code when it is not in PRE tags).
Try to be specific: what is it that happens and you don't like; or you would like to happen but it doesn't?
And use PRE tags.
|
|
|
|
|
what i have done is I binded DatatTable to binding Source and then binded that Source to that Grid .
No i Have written a method which will get List of all the files for slected directory and store it in the DatatTable which is binded to the source .
This method i have assigned to the thread ..
Now the datattable is getting updated but the Grid Is not getting refreshed ???
That is the problem
|
|
|
|
|
My experience with data binding is limited.
If the control is not tracking your changing datasource, the one way I know how to fix it is by setting the datasource to null, then assign the real one again. And maybe, never tried it, Control.Invalidate() also works.
|
|
|
|
|
Luc, isn't it a simpler problem? If he is indeed using separate threads, then he can't update the grid anyway without invoking the GUI thread - can he?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Yeah, one shouldn't touch the data binding properties from another thread, unless through Invoke. Not sure that's the problem, it could well be. This whole thread is unclear to me.
|
|
|
|
|
Below is the code written in row editing event of data gridview(in assumption that row editing can only be done if some control like textbox is there)
(TextBox)(GridView2.Rows[0].Cells [2]) = "a";
But is this syntax of object conversion correct?It is giving error as system cannot convert type string to system.web.ui.webcontrols
|
|
|
|
|
yes, because "a" is a string, not a textbox.
|
|
|
|
|
Try
((TextBox)(GridView2.Rows[0].Cells [2])).Text = "a";
|
|
|
|
|
Hi all,
Through IHTMLElementCollection we can get all the IHTMLElement.
I want to find out all the HTMLInputButtonElement that is in the current DOM.
How to navigate (frames,iframes,divs,tables) and find out the HTMLInputButtonElement
Is there any common algorithm.
Thanks in advance
|
|
|
|
|
I have created setup in C#.net using C# setup project.
I am Accepting servername,username,password in textbox.
Textbox has been added in setup project by adding textbox dialog in user interface..
but how to Accept Password in ** format during installation.??
Thanks in advance.
|
|
|
|
|
Try:
Password Textbox[^]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks dear.
For your valuable suggetion.
But for installation time textbox there is no such property exist.
This textbox is textbox dialog box which is provided in .net in set up project.
|
|
|
|