|
Write the bytes to a MemoryStream, then you can access the data once you are done reading. Basically thr MemoryStream will allocate an initial array, then keep moving the data to a larger and larger array as needed.
If you need to support large amounts of data use a FileStream instead.
|
|
|
|
|
Hi Friends I need a details and program for create a Trial version to an application in C# dot net 2005. Help me dear's..........
I got a code for this in vb dot net but i want it in c# help me ......
http://www.codeproject.com/useritems/registration.asp
regards
Sasi Kumar.V
-- modified at 7:12 Wednesday 10th October, 2007
|
|
|
|
|
Sasi Kumar. V wrote: I got a code for this in vb dot net but i want it in c# help me ......
It should be easy enough to convert. There's tons of ways of doing this anyhow, all pretty straightforward.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Compile it, then open the DLL in .NET reflector and disassemble as C#. I have not said this is the best way, but it certainly is a way.
|
|
|
|
|
Why do you need to do this? It's .NET and presumably it's should be CLS Compliant which means that it should be accessible from your assembly.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Where I'm working at the moment, I'm seeing a lot of this sort of thing:
if (ReferenceEquals(curve, null))
{
}
whereas I would personally just use:
if (curve == null)
{
}
Now I know that equality is more complicated than it sounds, so my question is, is there any merit in using the first approach over the second?
Regards,
Rob Philpott.
|
|
|
|
|
Well, IMHO ReferenceEquals method, when used to compare a reference with null , it's merely redundant.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
That would depend on where it is used.
For example: When you override the == operator, you may want to use ReferenceEquals() so that you don't end up with an infinite loop or other undesired effect.
|
|
|
|
|
override operators... you can do that?
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
public static operator bool == (MyObject lhs, MyObject rhs)<br />
{<br />
}
|
|
|
|
|
|
Hello,
I'm looking for a way to activate an existing browser session by means of a C# .Net executable.
I have found some code where I would be able to look for all active programs, and eventually even kill them. I did not find a way to activate a process, however.
private void button1_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process[] myProcesses;
myProcesses = System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process instance in myProcesses)
{
MessageBox.Show (instance.MainWindowTitle);
instance.Kill();
}
}
I need this to avoid the user to have logged in again.
I want to activate his open internet session, and eventually even refresh his session with a new url.
E.g.
http://localhost/sid=abc123?nameId=10
should be replaced by
http://localhost/sid=abc123?nameId=20 , in the same session, and triggered by an executable.
Is this possible ?
Help would be very much appreciated.
|
|
|
|
|
I doubt it's possible.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hai all,
I have to send mails through MAPI.
I have gone through the articles given in code project.
I have created a sample application. But when the send() method is called it is prompting a dialog box intimating an application is trying to send mail automatically... ... from the Microsoft outlook application. While clicking on the "Yes" option it is sending the mail.
But the above task should be automated in my module and it has to be done in a windows service.
Can any one give me a solution to perform the above without displaying the message box.
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Is there a reason you have to use MAPI over SMTP?
In this[^] example they specify the user cannot edit the message (which I believe means it is not shown to them).
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Yes, because i have to have the items in the "Send Items" folder of the outlook.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
That makes sense. Can you post the code that you are using to call MAPISendMail?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
The code is:
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using Microsoft.Office.Core;<br />
using Outlook = Microsoft.Office.Interop.Outlook;<br />
<br />
namespace ExchangeMAPI<br />
{<br />
public partial class MailUsingMAPI : Form<br />
{<br />
public MailUsingMAPI()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void btnSendMail_Click(object sender, EventArgs e)<br />
{<br />
object missing = System.Reflection.Missing.Value;<br />
<br />
Outlook.Application outlookApplication = new Outlook.Application();<br />
Outlook.NameSpace nameSpace = outlookApplication.GetNamespace("MAPI");<br />
<br />
nameSpace.Logoff();<br />
nameSpace.Logon(missing, missing, true, false);<br />
<br />
Outlook.MailItem mail = (Outlook.MailItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);<br />
mail.To = txtReceiverAddress.Text;<br />
mail.Subject = txtSubject.Text;<br />
mail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;<br />
mail.HTMLBody = "<html><body><p>" + txtMessage.Text + @"</p></body></html>";<br />
mail.Send();<br />
}<br />
}<br />
}
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
You are using the Outlook interop, not MAPI (even though you are getting the MAPI namespace). If you look at the documentation[^] for the MailItem.Send method, you will see that it says the dialog will be shown. This is a security measure, so I doubt you would be able to programmatically suppress it.
You should be able to configure the Outlook UI to suppress it though (depending on your version). I'm running Outlook 2007, and I can disable it under the "Tools->Trust Center..." menu item. In the dialog select "Programmatic Access", and select the "Never warn me..." option. This is not recommended by Microsoft or me.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I am using Microsoft Outlook 2003, so where can i find this option.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Sorry, I don't have Outlook 2003, so you'll have to find it yourself. This[^] may help though.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi,
I'm new to programming in C#, actually learning under someone. I recently saw the following line of code in the code-behind of an ASP.NET Web application page :
//all the other autogenerated codes
static DataSet dSet; // explain this line please.
What does it mean to make a DataSet static?
Thanks for your time.
Obinna from Nigeria.
|
|
|
|
|
ObinnaAj wrote: What does it mean to make a DataSet static?
Hi, Obinna. In an ASP.NET project, this makes no difference, because of how ASP.NET works. In general, it means that if you have a class like this:
class Widget
{
public static int widgetCount = 0;
}
then the value of widgetCount is the same across all instances of the program. If the Widget constructor looked like this:
public Widget()
{
++widgetCount;
}
Then, every widget would have the same value, and it woild not be 1, it would be equal to the number of widgets that had been created. In fact, in C#, if you do this:
Widget w = new Widget();
int n = w.widgetCount;
The compiler would not allow it. You need to do this:
int n = Widget.widgetCount;
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: public Widget()
{
++widgetCount;
}
Could you tell any sample scenario where we need to use this kind of increment ? i don't find any use of incrementing the static value.
|
|
|
|