|
One way is
string[] files = Directory.GetFiles("c:\\dev", "*.cs");
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi everyone I am trying to subtract cells in excel from a C# application.I have a for loop that fills the cells in excel. Thanks
|
|
|
|
|
To insert a formula into a cell just write the formula you want into that cell instead of assigning the cell a hardcoded value, exactly like you would using MS Excel
|
|
|
|
|
No you cant because I have a for loop and if you put that into excel its only going to sum 2 cells not the for loop but its ok I got it right.Thanks for youre answer.
|
|
|
|
|
Hi All
I am facing a strange issue and i am working on this issue for last one week,but i am not able to find it.I have a window service which reads the MSMQ .This windows service will do only this function.Now, when some thing is written to MSMQ, window service will read the msmq.Now there is nothing in queue ,then also it will loop and if some thing comes inside the msmq then again it will read ...this works fine if i am doing in regular intervals.
Now if am not doing any operations for two or three hours ,then status of windows service will be started but it will not reading the msmq,and it is not throwing any error..also...this is the strange thing i am facing..why it is behaving like this.Can any one help me in this idea.I am pasting the start section of of mywindows service here .can any one tell me what is wrong in this code.Thanks in advance
this code i am calling inside a thread..
try
{
MessageQueue mq = null;
System.Messaging.Message msg = null;
while(true)
{
//MessageQueue mq = null;
//System.Messaging.Message msg = null;
try
{
if(mq == null)
{
mq = new System.Messaging.MessageQueue (XMLReprocessMSMQPath);
}
RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,"Read Queue", LoggingMessageTargets.Both);
msg = mq.Receive(new TimeSpan(0,0,0,10,0));
RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,"Data Rec", LoggingMessageTargets.Both);
msg.Formatter = new ActiveXMessageFormatter();
XMLReprocessMSMQFileName=ReceiveMessage(msg.Body.ToString());
SendXMLToWebervice(XMLReprocessMSMQFileName);
}
catch (System.Messaging.MessageQueueException ex)
{
if(ex.ErrorCode != -2147467259) // Ignore timeout error
{
RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,ex.ToString(), LoggingMessageTargets.Both);
mq.Close();
mq.Dispose();
mq = null;
MessageQueue.ClearConnectionCache();
Thread.Sleep(10000);
}
else
{
mq = null;
}
}
catch (Exception ex)
{
RemoteLoggingManager.LogMessage(LoggingMessageTypes.Error, APPLICATIONNAME,ex.ToString(), LoggingMessageTargets.Both);
mq.Close();
mq.Dispose();
mq = null;
MessageQueue.ClearConnectionCache();
}
}
}
catch(Exception ex)
{
RemoteLoggingManager.LogMessage(LoggingMessageTypes.Information , APPLICATIONNAME,
"Reprocess MSMQ Catch block :" + DateTime.Now.ToLongTimeString(), LoggingMessageTargets.Both);
}
finally
{
RemoteLoggingManager.LogMessage(LoggingMessageTypes.Information , APPLICATIONNAME,"Finally block executed " +
DateTime.Now.ToLongTimeString(), LoggingMessageTargets.Both);
}
Regards
DilipRam
|
|
|
|
|
Hi guys.
I have, after alot of hard work, finally got this to work - well.... almost
I have a remoting server using TCPChannel. And i got some clients connecting to this server. When i from the beginning connects 3 client, all works fine, when someone connects, the server sends events to each client that they should update their list of clients. But when one of them Disconnects with this code:
if (SignedIn)<br />
{<br />
server.SignOut(MyUniqueID);
ChannelServices.UnregisterChannel(Channel);<br />
}
And then siqns in again, he's not getting the event when someone connects or disconnects, but the other clients does, even when the failing client connects/disconnects. BUT if i close this one client that fails, and open it up again, it all work just fine again, very strange.
I got a very simple and clean example code if anyone wants to help me
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();<br />
serverProv.TypeFilterLevel = TypeFilterLevel.Full;<br />
<br />
IDictionary props = new Hashtable();<br />
props["name"] = "ServerChannel";<br />
props["port"] = 666;<br />
<br />
<br />
TcpChannel Channel = new TcpChannel(props, null, serverProv);<br />
ChannelServices.RegisterChannel(Channel, false);<br />
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Server), "Server", WellKnownObjectMode.Singleton);<br />
<br />
Console.WriteLine("Server is running...");
inaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();<br />
serverProv.TypeFilterLevel = TypeFilterLevel.Full;<br />
IDictionary props = new Hashtable();<br />
props["port"] = 0;<br />
<br />
CallbackSink.OnHostToClient += new ClientEvent(OnHostToClient);<br />
<br />
Channel = new TcpChannel(props, null, serverProv);<br />
ChannelServices.RegisterChannel(Channel, false);<br />
server = (Server)Activator.GetObject(typeof(Server), "tcp://127.0.0.1:666/Server");
|
|
|
|
|
|
|
Hello,
can anyone illustrate a step by step procedure for using resource manager or some equvalent in C#.
I am not able to embed the main assembly resource file, .resources, in
the executable assembly.So please guide me in creating and embedding resource files as well.
Keshav Kamat
India
|
|
|
|
|
Look around on this site, there are some articles on embedding resources into assemblies.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Some of the functionalities can't write in .net easily, where as possible in C, C++, VC++. So how to use those libraries in .NET (C#).
|
|
|
|
|
|
Hi,
I have created a DLL in dotnet and it accepts one parameter i.e string.
When i call the method of the dll it throws me following error:
Error Type:
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment: 'display'
/project/usedll.asp, line 46
Please suggest.
Pavas
|
|
|
|
|
How are you calling the method in that dll ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
'Below is the code in ASP file. I am sending a int value
Dim Obj
int i
i=2
Set Obj = Server.CreateObject("ClassLibrary1.Class1")
response.write Obj.methodname (i)
Pavas
|
|
|
|
|
But you sending the int instead of string ...
mpavas wrote: Obj.methodname (i)
Check the argument that the method is expecting
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
I tried sending both and Int and String. Both of them resulted in an error
The method detail in C#
public int PostCreate(int key)
{
return key;
}
Pavas
|
|
|
|
|
Let me reframe. This dll is created in .NET and I am using it in ASP. The dll works fine with out parameters.
Pavas
|
|
|
|
|
Hello,
Which are the faster functions in order to read/write a file?
I must write string in a file in a cycle and must be fastest possible!
Thanks a lot.
Alex
|
|
|
|
|
1) Have you meassured a performance problem or are you simply expecting it? Unless you do something strange I doubt you will notice any performance differences between the various ways of writing to files.
2) If you have performance problems are you sure it is not in the disk IO system instead of your code? If it is, get faster disks or more memory for diskcache, or start collecting changes in memory and write them in batches (possible on a worker thread, but then you must take care of locking etc).
Besides this it is not easy to help you when you do not provide more information on what you are trying to write and for what purpose.
|
|
|
|
|
does somebody knows where can i get a maskedtextbox that can support transparent background
-TheCardinal
|
|
|
|
|
Hi
I am busy going through netron application so i want to know if is possible to save netron graphs as an xml and how.i have gone though it several times but i can figure it out as is too complex.
Mamphekgo
|
|
|
|
|
mamphekgojakes wrote: i want to know if is possible to save netron graphs as an xml and how
Possibly, but since I don't know what a netron graph is I can't help much. Perhaps if you explained what one is.
|
|
|
|
|
Which version of Netron? Unloaded, Unfold, new Netron, old Netron?
Off the top of my head, I can't remember if Netron ships with an XML serializer, but if it doesn't then one way that you could do it is to iterate through the Shapes collection of the graph and write out the attributes from the serialization context.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|