|
|
Thanks
|
|
|
|
|
Not quite, you're probably going to get a ThreadAccessException if you do that. You'll need to create a delegate which can return the value. You can then pass this delegate to the Control.Invoke method to retrieve the value. Alternatively you can use the feature of anonymous delegates (can't remember what it's called) where you can access the variables surrounding it. E.g. (note I'm writing this code from memory)
internal delaget int GetCurrentCount();
private int count = 100;
private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
int threadedCount = -1;
this.Invoke(new GetCurrentCount(delegate() { threadedCount = this.count; }));
}
|
|
|
|
|
hi i want to listen on http port, or i want to make a socket server that will listen on http port and get the data, but when i use socket bind method then this exception is raised
"Only one usage of each socket address (protocol/network address/port) is normally permitted"
can u plz help me how to do that i mean get the data from http port using sockets.
Regards.
Tasleem Arif
|
|
|
|
|
You can only listen to 1 port at a time. That mean, http port is being used, another application listen also in this port. You must shutdown this application so you can start your application.
|
|
|
|
|
hi
is that anyWay that i see preview of setup dialogs in setup project, (i want to change banners of setup dialogs, but i don't what is resolution, and how to see preview of it ?)
thanks
|
|
|
|
|
|
why not just build it and run it? If the rest of the installer takes to long for this to be feasible then how about making a dummy setup project that just runs through your dialog sequence and exists?
|
|
|
|
|
How to display a message while draging and droping an item from the tree view?
plz help
thanks
Aparna.B
|
|
|
|
|
Take a look at the DragDrop event. Handle the event, and put your code inside it.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
it is not working in drag and drop event
|
|
|
|
|
What do you mean it's not working? Be more specific, "it's not working" could mean quite a few things. There is an error on build, you get an exception when running, or it doesn't do anything. If it just doesn't do anything, you might want to try DragEnter , DragLeave , or DragOver events. Maybe those better suit your needs.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
I am using the following code to write to a .csv file.
Each time this is run, a new file is created, but the old one gets deleted.
I would like to add a new file each time so the files get added to the files folder.
I have tried FileMode.Append, FileMode.Append but none of them do what I am after
Thanks
private const string dir = @"C:\Files\";
private const string path = dir + "Securities.csv";
// create the output stream for a text file
StreamWriter textOut =
new StreamWriter(
new FileStreampath, FileMode.Create, FileAccess.Write));
|
|
|
|
|
Do you want to have a new file every time? Use a different file name every time, such as appending a time stamp to the file name. You are overwriting the same file every time right now.
|
|
|
|
|
I see.
Now trying to change the name each time by adding the time to the path as follows.
What is the correct syntax for the following code please?
Is this correct?
Thanks
private const string path = dir + "Securities_" + DateTime.Now.ToString() + ".csv";
|
|
|
|
|
DateTime.Now.ToString() will have invalid characters (semicolon etc)for a file name so you do not want to use ToString().
private const string path = dir + "Securities_" + DateTime.Now.ToString("HHmmss") + ".csv";
You _may_ still be overwriting older file with the same file name of same time stamp, though, but you can add date to the file name, ie DateTime.Now.ToString("yyyyMMddHHmmss"), assuming you wont be creating more than 1 file within 1 second.
DateTimeFormat[^]
modified on Wednesday, January 23, 2008 7:45:42 AM
|
|
|
|
|
|
You could check to see if the file exists, if it does then add a number to the end of the name to differentiate it, check it again, if it happens again then increment the number.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi guys,
Can anyone explain to me how to update/remove appointments from MS outlook through c# ?
thanx all.
|
|
|
|
|
Use the MS Office Interop components. Here's[^] the MSDN example of how to get appointments, deleting and updating them is probably just another function call or two . . .
|
|
|
|
|
how can i add a new node in treeview for an xml backend file? and save it?
|
|
|
|
|
samidhas wrote: how can i add a new node in treeview for an xml backend file? and save it?
I suggest you break your statement down to it's individual problems and solve each one separately until you understand each of them well enough to tackle the complete set of requirements.
led mike
|
|
|
|
|
I replied to your other thread, but you should be using the XMLDataSource and it's Save method to save the XML.
I beleive you should just be able to add nodes by creating a new node entry.
TreeNode newNode = new TreeNode();
newNode.Text = row["CategoryName"].ToString();
newNode.Value = row["CategoryID"].ToString();
newNode.PopulateOnDemand = true;
newNode.SelectAction = TreeNodeSelectAction.Expand;
node.ChildNodes.Add(newNode);
|
|
|
|
|
I have a stand-alone class library project with an app.config file. I compile this file and place the compiled dll/config file into the bin\debug folder of the application described below.
I have an application project that includes a reference to that class library (the DLL that's in the bin\debug folder). This application also has an app.config file.
When I run the app, it instantiates a class in the class library assembly which tries to read the dll file's config file. .Net pukes at this claiming:
Configuration system failed to initialize
When I inspect the detail of the crash, I find this:
Only one <configsections> element allowed per config file and if present must be the first child of the root <configuration> element. (C:\\Work\\MyApp\\bin\\Debug\\MyApp.vshost.exe.config line 278)"}</configuration></configsections>
What's going on here?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Can you post line 278?
It's likely that a node has been defined twice and the schema for the configuration settings only allows it to be defined one. An example of this I ran into was when I thought that (for example) the urlMappings elements of the web.config file hadn't been defined, so added my own, only to find that it had been declared somewhere else and I'd just missed it.
|
|
|
|