|
Create a random object and use that to create random numbers.
Random rnd = new Random();
int value = rnd.Next(1, 101);
Yes, it works in framework 1.1, which is what is used with Visual Studio 2003.
---
b { font-weight: normal; }
|
|
|
|
|
Hi, I am new to C# and programming in Windows Forms.
I use DataSet.ReadXml and DataSet.WriteXml and Save and
OpenFileDialog to get the filename. I want to save and read some data from the path that the program starts.
In my previous programming language I could easily get the path of the exe file, however Directory.GetCurrentDirectory returns the path that I most recently used in the FileDialog. Is there a Function that returns the path at start of the process (program)
Thasnks
Ramith Sivanarain
|
|
|
|
|
Ramith Sivanarain wrote: Is there a Function that returns the path at start of the process (program)
Try Application.StartupPath
|
|
|
|
|
Hello,
I've read the following article:
http://www.codeproject.com/csharp/globalhook.asp
The code is working very well except for the problem the author mentioned:
Question:
I have a long delay when closing applications using hooks by clicking the x button in the titlebar. If I close the application via another event (button click) for example, that works fine.
Answer:
It's a know bug of Microsoft. It has to do with the Windows themes. If you disable the Windows themes, the problem goes away. Another choice is to have the hook code run in a secondary thread.
Can anyone tell me how can I 'have the hook code run in a secondary thread'?
I would really appreciate your help. Thanks.
|
|
|
|
|
I need to send some command to an external device through IR PORT
I am using a USB to IR Device which will act as the IR Port
How to use this IR Port?
Please Help
Rabindra
|
|
|
|
|
|
Thanks for the reply.
Actually I want one way communication. ie I want to send commands to a dumb hardware which can only receive IR command and perform accordingly.
like a TV.
the hardware is a switcher.
here the connection is not established as the switcher can't reply back.
please help
the link you have provided is not working. It is showing the following
"Location Cannot Be Found
We apologize for the inconvenience, but the location you are seeking cannot be found. If you are looking for a particular document, please try one of the following areas:
...."
Rabindra
-- modified at 23:49 Sunday 29th October, 2006
|
|
|
|
|
I want to receiver and send data with internet and network LAN using C#. But I don't know function and library. who can help me, please? as detail as posibly. thanks!
|
|
|
|
|
|
for example if i have a string like this:
string str = "System.Data.OleDb.OleDbParameter";
then i have object like this:
object obj;
the question how do i convert the type of obj to the value of str?
thanks so much
|
|
|
|
|
Try the static method Type.GetType(string). It will return a Type object that you can manipulate using reflection. I don't know if there is an easy way to do what you want to do. I will research it.
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
|
Sorry, I thought this would work but it doesn't. I will leave it here in the hopes that it might spark an idea on how to do it.
string stype = "System.Int32";
Type t = Type.GetType(stype);
IConvertible converter = (IConvertible)t;
object obj = converter.ToType(typeof(int), CultureInfo.InvariantCulture);
int i = (int)converter.ToType(typeof(int), CultureInfo.InvariantCulture);
InvariantCulture is a static property defined in the System.Globalization.CultureInfo class.
-- modified at 1:35 Friday 20th October, 2006
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
You're half way there cap'n, you need to use Activator.CreateInstance on that Type object obtained using Type.GetType
|
|
|
|
|
Thanks! I knew that, I just couldn't remember
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
how do i use the Activator.CreateInstance on the type?
thanks
|
|
|
|
|
Have you tried the documentation?
|
|
|
|
|
Hi,
In my Bin's Release folder (C# Windows project .NET 2.0), I see two identical files have been created,
1] MyProjectName.exe.config
2] MyProjectName.vshost.exe.config
I understood that, MyProjectName.exe.config is the output version of App.Config file, but what is MyProjectName.vshost.exe.config and why is that required ? If I dont ship that file to my user's computer, will there be any problem for running the software properly ?
|
|
|
|
|
|
Thanks a lot. I got my answer
|
|
|
|
|
Well a quick search on google brought me this:
By default every time you compile a WindowsApplication or ConsoleApplication project using VS2005, a "vshost.exe" and a "vshost.exe.config" files are created on the \Bin\Debug and \Bin\Release paths.<br />
<br />
The purpose of these "vshost.exe" and a "vshost.exe.config" files is described <a href="http://msdn2.microsoft.com/en-us/library/ms242202(VS.80).aspx">here</a>[<a href="http://msdn2.microsoft.com/en-us/library/ms242202(VS.80).aspx" target="_blank" title="New Window">^</a>].<br />
<br />
To disable this feature you need to:<br />
<br />
Open a project in Visual Studio. <br />
On the Project menu, click Properties. <br />
Go to the Debug Tab <br />
Clear the Enable the Visual Studio hosting process check box.<br />
<br />
Another common question is if we need to deploy these files and the answer is No, the "*.vshost.exe" and "*.vshost.exe.config" files are only for use in the Visual Studio 2005 IDE<br />
<br />
Pablo
Short answer? no you don't need to ship this out with the app, at least im pretty sure anyways...
Damn, beaten to it... ah well
|
|
|
|
|
|
try
{
System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage();
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","10");
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername","SmtpHostUserName" );
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","SmtpHostPassword" );
message.From="mymail@hotmail.com";
message.To="anymail@hotmail.com";
message.Subject="hi";
message.Body="worked";
System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address";
System.Web.Mail.SmtpMail.Send(message);
}
catch(Exception ex)
{
Response.Write(ex.Message.ToString());
}
-what is SmtpHostUserName and SmtpHostPassword and how can i get "SMTP Server Address"?
-the "10" iis Default SMTP Virtual Server propertis take the number right?
-some thing missing here can any one help
thank you
Mohsen
-- modified at 22:28 Thursday 19th October, 2006
|
|
|
|
|
Ah_Mohsen_aly wrote: what is SmtpHostUserName and SmtpHostPassword
The username and password for the mail account in question.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi guys,
This activex control has optionals parameters for GetData method:
this.axWinsock1.GetData(ref object data,object type,object maxlen)
i tried these:
object rec= string.Empty;
object type = 0;
object maxlen = 0;
this.winsock.GetData(ref rec, type, maxlen);
or
object rec= string.Empty;
object type = string.Empty;
object maxlen = string.Empty;
this.winsock.GetData(ref rec, type, maxlen);
but all i get is "Unsupported variant types" error message, do you know how to call this getdata method in c#? i know if you call it in vb.net you dont need to pas optional parameteres.
Please help
|
|
|
|