|
The CheckState enum is like this
Unchecked = 0,
Checked = 1,
Indeterminate = 2 You can use the CheckBox.CheckState property to get the current value.
If you need to retrieve it via an event when it changes you can use the CheckBox.CheckStateChanged event.
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)
|
|
|
|
|
Good people,
Quick question: Is it ok to install application files in the root directory (C:\My App\DataFiles.app)? We have an application and I think the file should be installed in the SpecialFolder.ApplicationData path. I always thought that the root directory should not be a place where app files should be deployed unless absolutely necessary.
Let me know your thoughts?
Thanks,
Blitz
|
|
|
|
|
IMO you should not do so. It gets messy pretty soon. AFAIK Vista and future Windows will prevent regular users from doing that anyhow.
The app itself belongs somewhere under C:\Program Files\ using some folder hierarchy reflecting company and product name and possibly version.
The data files your app needs could go in one of the special folders provided for such purpose.
See Environment.GetFolderPath, and SpecialFolder.ApplicationData/CommonApplicationData. There too some folder hierarchy should be applied.
And the user-visible files your app deals with (its documents) probably belong somewhere inside "My Documents" which also should be reached through the corresponding SpecialFolder.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks Luc,
Where should the LogFile (of database errors) be placed? We may need them to email it to us for support purposes.
Thanks again,
Blitz
|
|
|
|
|
I guess your DB logfiles are common to all users, hence I would suggest SpecialFolder.CommonApplicationData; that is where I put user-agnostic logfiles.
And I try and provide a command inside my app to explore that folder, or mail it to me, or whatever is appropriate; so the users don't have to explore their disk to get hold of it, and I don't have to explain the details in the documentation (since that folder may actually vary depending on the Windows version and some installation choices).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc, what would you do with the Log file?
Thanks,
Blitz
|
|
|
|
|
I would be angry if a program would do that to me..
In fact, I have been angry for that reason quite often already.
Both Java and nVidia see fit to place their crap in C:\
|
|
|
|
|
Thanks to both of you.
By the way, do you know where I can find documentation recommending against using the root directory. The other programmer is a Java programmer and thinks that writing to the root directory is fine.
Thanks again for your help,
Blitz
|
|
|
|
|
It would only be "fine" if the computer that hosts your application is a dedicated PC that will only be used with your application.
If not, then try and integrate with the pre-existing environment; add applications where other applications are found, write docs to the place where documents go, and errors the the EventLog. Though it might sound insane to scatter all data over different folders, there is a rationale behind it. I regularly backup "My Documents", but I hardly ever backup "Program Files" or the crap that's in the root - having the same executable backed up over and over would be inefficient. The moment my PC stops working, the Admin remotely looks into the eventlog and mails me that I should not disable the Norton Antivirus-service. He puts back an image with my applications, and I restore my Documents.
The need to put every existing folder in the PATH has gone. What argumentation is there left in favor of installing to the systemroot?
I are troll
|
|
|
|
|
Hi,
I need a help.
I have a windows service to keep monitoring installed stuffs and at the end like, when i logoff or shutdown, it has to automatically uninstall those dlls and get killed itself.
I could do till uninstall, but i dont know how to make the windows service to get killed by itself.
Any idea/ sample code would be helpful
Thanks
Kumar
|
|
|
|
|
Sounds like you don't want a Service at all, how about a Windows Scheduled Task?
|
|
|
|
|
Thanks.
Ok, what i am looking for is like, when i am logging off, i had made my windows service to uninstall certain dlls. Once it is finished, it has get killed itself and get uninstalled, because, it should not do the uninstall for the next time logoff.
Thanks
Kumar
|
|
|
|
|
I've adapted other code i found on the internet to use postmessage instead of mouse_event i think it was: http://wolfsfiles.googlepages.com/MouseSimulatorPostMessage.cs[^]
So... my goal is to send mouse clicks to a window without bringing it into focus... that code does do the mouse clicks just fine but it automatically brings the window into focus. (if i use sendmessage it does the same behavior... also what's the difference between postmessage and postmessageA? :P)
So is their anything i can do to send the mouse click without bringing the window into focus.
|
|
|
|
|
FocusedWolf wrote: is their anything i can do to send the mouse click without bringing the window into focus.
I don't think so. Depending on what your higher goals are, there may be better ways to achieve them.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I've made a kind of telnet class that has these methods:
+Connect()
+string Response() : Reads the stream
+string SendMessage() : Writes to the stream and calls response()
The problem is that if call response and there is no response, I get stuck..
I tried using networkStream.DataAvailable but still gets stuck,
algo tried making a
while (timespan.Seconds < timeout) {
..
}
But still.
For example if I conncet to a POP server, this could happend.
I say: RETR 2
1st line of response
I ask another line of response (calling Response())
2nd line of response
Repeat these last two lines until...
I ask another line of response
-here it gets stuck because there arent more lines-
|
|
|
|
|
Start a timer whenever you say something. If there's no response in 30 seconds, chances are that there won't be a response at all. In that case, you can give the user the option to either;
* keep waiting
* abort the waiting
Good luck
I are troll
|
|
|
|
|
Well I tried that but it stills get stuck,.. I think its stuck on the .ReadLine() and doesn't give the chance to continue with the while's condition (timespan.Seconds < timeout)
I think threading is needed here.. but in the background the .ReadLine() would still be stuck consuming CPU :/
public string Response()
{
if (!cl.Connected) { return null; }
timeoutCheck = DateTime.Now;
TimeSpan timespan = DateTime.Now - timeoutCheck;
while (timespan.Seconds < timeout)
{
if (ns.DataAvailable)
{
if (secure)
{
return secureReader.ReadLine();
}
else if (!secure)
{
return nsReader.ReadLine();
}
}
timespan = DateTime.Now - timeoutCheck;
}
return "timeout waiting response";
}
|
|
|
|
|
Quake2Player wrote: in the background the .ReadLine() would still be stuck consuming CPU
Blocking calls such as ReadLine() do not consume CPU cycles, the underlying input/output operations are event driven: when nothing happens, nothing gets processed. The only cost is memory, the thread that executes the call just sits there, with the memory associated to it (mainly its stack).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I am trying to read an xml file into a dataset and have been met with nothing but problems.
The xml file is in the following format:
<?xml version="1.0"?><br />
<Catalog xmlns:dt="dt"><br />
<Rec><br />
<ITEM dt:dt="string"></ITEM><br />
<QTY dt:dt="string">1</QTY><br />
<SUB dt:dt="string"></SUB><br />
<CATALOG dt:dt="string">ABC123</CATALOG><br />
</Rec><br />
</Catalog>
I have tried this code in C#:
<br />
Dataset ds = new DataSet("Test");<br />
ds.ReadXML(OFD.FileName);<br />
The touble is that all have in the Dataset is a table called "Rec" and one column called "Rec_Id", clearly this is not what I want!!
If I remove the dt:dt="String" datatypes then everything is fine.
I think this can be done by specifing a schema, but I do not know how you do this whilst reading into a dataset nor do I know enough about schemas to know what to specify where!!
Can anyone help?
Thanks
|
|
|
|
|
I cannot explain why you are having this problem, but I can tell you what is happening.
If you set a breakpoint in your code, immediately after the ds.ReadXML(OFD.FileName); and examine your members in the Autos window.
You will find that ds has had its name changed from "Test" to "Catalog", which it has obviously picked up from the xml file.
If you then expand the Tables node, then the list node you will see that you in fact have 5 tables
[0] Rec
[1] ITEM
[2] QTY
[3] SUB
[4] CATALOG
As I said above, I do not know why this happens, but you have already found the cure.
M_Aurelius wrote: If I remove the dt:dt="String"
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
A couple of things come to mind:
Do you own the form (implied by removing the dt:dt)
Why not create a table in a test program with the structure you want and write the dataset out, you then ahve the format to work with.
Failing that use xpath to traverse the xml and populate said table manually!
Failing that post it the the XML forum [^] to get a sensible answer
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for your replys guys.
The xml file is generated automatically by some software we use and I want as little manual intervention as possible so I shall try the xml forum (which I hadn't actually noticed ).
Failing that I shall indeed try xpath to see whether it works.
Cheers
|
|
|
|
|
Hi Friends,
I googled the whole night and I browsed MSDN the entire day, but I did not find any results because what I wanted to know, maybe was termed as unneccasary or malfunctioning. Actually, I want to replicate my Console Program to a particular destination with the user's complete knowledge and permission. But the thing is that, I want to do that programmatically (i.e. not by exiting the program an then Copying or pasting it).
Like this:
Console.WriteLine("Are you sure to copy this program to C:\Program Files\? Press 'Y' for confirmation or 'N' to exit and hit enter");<br />
if (Console.ReadLine()=="Y")<br />
{<br />
}<br />
else if(Console.ReadLine()=="N")<br />
{<br />
return;<br />
}
Please help me. And also tell me if I am clear.
Cheers,
Rajdeep.NET
|
|
|
|
|
You may or maynot be able to actually do this, while the program is running.
Couple thoughts come to mind:
1). The normal means: File.Copy[^]
2). CreateProcess to a batch file that copies the .EXE from local to wherever
3). Save the state of your console app, create process to external program and terminate. External program copies app and then starts it back up, restore console app state.
That's "off the cuff" ...
|
|
|
|
|