|
Nope. If you have 9 independent buttons, you are going to need 9 different properties. How else would button 2 have an independent state from button 3?
|
|
|
|
|
Ok I've got this now. Thanks for the reply!
|
|
|
|
|
I'm trying to scrap this website:
http://datasuite.cmegroup.com/dataSuite.html?template=opt&productCode=6E&exchange=XCME&selected_tab=fx[^]
And to be specific the quote table inside. The table is generated by javascript somehow. I don't know how to scrap this table. I tried to use WebRequest,HttpWebRequest, WebBrowser control, html agility pack and nothing works.
It gives me blank page all the time.
When I run it in mozilla (the web) and check the source code it also shows the javascript reference only without any html table code.
Anyone have a clue how to scrap this data from the table?
|
|
|
|
|
If you dig through the JavaScript (namely dataSuiteUtil.js and dataSuite.js) you will see that it is done using AJAX. It has a handleRequest() method which it seems is the one to load and display data. Not sure how to get around it but I thought I'd try and help by pointing out what I found.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
I dont understand how I can make the "Define File Type" code an instance (is that the term I'm looking for) so it can be be read in the "Open IE and Print" segment.
// Define File Type
foreach (FileInfo finfo in dir.GetFiles("*.html"));
// Open IE and Print
if (Application.Current.Properties["finfo"] != null)
Have tried defining it as a string but I get the following error.
"Cannot convert type 'string' to 'System.IO.FileInfo'"
Any help would be greatly appreciated to help me understand C# further.
|
|
|
|
|
Directory.GetFiles(string) returns an array of 'string' objects, not a FileInfo object. Each string contains the file names (including their path) in the directory.
http://msdn.microsoft.com/en-us/library/07wt70x2.aspx[^]
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
You really should look up the various classes and methods you are using on MSDN.
Directory.GetFiles with one string parameter will return an string array containing the path of all files in the directory specified in the parameter. If you want to specify a search pattern, you need to pass two string parameters, the first being the path to the directory, the second being the pattern.
The result will be a string array. You can foreach over that and pass each string into a FileInfo constructor if you wish.
|
|
|
|
|
To add to what the others have said: get rid of the semicolon.
foreach (blah blah in blahs);
if (myCondition) Becomes
foreach (blah blah in blahs)
if (myCondition)
With it present, the if condition is executed outside the loop, not in as the indentation suggests.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
I am not sure, but I think you can do:
foreach (blah blah in blahs)
if (myCondition)
blah.Name = "Hello";
|
|
|
|
|
This should get you along the way.
foreach (String filename in dir.GetFiles("*.html")){
FileInfo finfo = new FileInfo(filename);
if (Application.Current.Properties["finfo"] != null){
}
}
hope this helps.
|
|
|
|
|
Sorry for the late reply, Thank you V this worked perfectly.
|
|
|
|
|
Cool, glad to be of help
|
|
|
|
|
I am trying to create a file on a directory where I have total power.
The File.Create (..) (as well as any other attempt to create the file even using FileStream()) always fails with the UnauthorizedException .
This is not possible since I have permission to write and create files on that directory (after all I can easily create a file by hand there).
Is there an explaination ?
|
|
|
|
|
tiwal wrote: This is not possible since I have permission to write and create files on that directory (after all I can easily create a file by hand there).
Lousy way to test.
Does your code run under YOUR credentials? What path and filename are you trying to write to?
|
|
|
|
|
I am running a debug instance of my program.
VS runs under my credentials.
The path is simply the debug folder of the application.
This is the same path where I was successfully reading and writing, yesterday, using the same VS, and NO change has been made since .
|
|
|
|
|
tiwal wrote: This is the same path where I was successfully reading and writing, yesterday, using the same VS, and NO change has been made since
If the universe did not change it would behave the same. Something changed.
Are you running a copy off the application outside the debugger? Viewing the file using a viewer that could "lock" the file?
tiwal wrote: VS runs under my credentials.
There's no "run as admin"-shield on the taskbar-icon?
|
|
|
|
|
Something has changed for sure . But if I were the one who changed that something I wouldn't be here to pose this question.
I am not running anything which may lock the file. After all the file cannot even be created.
Running the environment as administrator even worsened things, as now the path of the file changed to something "like" root ("C:.\filename", which doen not even elaborate to a regular path).
|
|
|
|
|
tiwal wrote: as now the path of the file changed to something "like" root ("C:.\filename", which doen not even elaborate to a regular path). I would suggest you have a bug in your code which is leading to an invalid path somewhere. Use your debugger to step throught the code and see the exact values of the variables that are used to create the path.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Depends on what user the application is running under, rather than what access you have.
If this is winforms, then I would expect it to run under your user, but a service won't, for example.
Double check the folder address, and check the user ID it runs under - if it is complaining, then it is doing so for a reason!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
I am not sure I am understanding well. Tou mean , checking the folder I am trying to write to ?
|
|
|
|
|
Check the name, yes - make sure that the folder you are trying to write to is exactly the folder you think it is.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
hellow every body
I know this question is verey primary but I realy need its answer
how can i use poinrets in C#? please help me by an instance
|
|
|
|
|
You would also have to explain "what" the problem might be. If the problem is as broad as "I don't understand them", then the answer will be equally broad. For a general introduction to the topic, see MSDN[^].
|
|
|
|
|
tnx u
|
|
|
|
|