|
Thanx for replying!
i have used this code ..
private void button1_Click(object sender, System.EventArgs e) {
MailMessage myemail = new MailMessage();
myemail.From ="Tushar";
myemail.To ="a_tushar@hotmail.com";
myemail.Subject ="Test";
myemail.Body ="How are you ";
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send (myemail);
}
using this all my mails are stored on my computer only they are not being delivered at a_tushar@hotmail.com
|
|
|
|
|
Well, the from should be an e-mail address.
|
|
|
|
|
This isn't his problem. As Mazdak said, we answer his question several days ago. His problem is that he hasn't configured the SMTP Virtual Server in the Internet Information Manager. I gave him pointers how to get started and told him to read the help, but he obviously hasn't.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
We answer you some days before. Look at those links and see how you should send email by C# and stop reposting the same question please.
Mazy
No sig. available now.
|
|
|
|
|
Once again I'll tell you that you're code isn't the problem - the problem is that you have NOT configured the SMTP Virtual Server at all or correctly. Again, go to Internet Information Manager in your Administrative Tools folder in the Control Panel and find the SMTP Virtual Server. You have to configure this to send mail using SMTP. It isn't setup by default but there's very little to do. Just read the help files which should be easy to understand.
Once again - as Mazdak also said - this is not a problem with your code, hence quit posting it in the C# forum. It is a problem with your machine configuration of the SMTP Virtual Server. If you need additional help, go to http://support.microsoft.com[^]. It really isn't hard to configure, though.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hello again guys.
I have a new problem.
I made a button, which was had a keypress event and it worked perfectly.
Now I've a panel and it hasn't keypress event among its public stuffz.
How can i add my keypresseventhandler function to this panel?
MS Visual Studio.NET 2003
C#
|
|
|
|
|
I may be wrong about this, but I think you have to add the handler to the Form object that contains the Panel, and test if the Panel has the focus.
|
|
|
|
|
Well, i tried to add the handler to the form object, but I can't.
Here's what i did:
public Form1()
{
...
this.KeyPress += new KeyPressEventHandler(this.keypressed);
...
}
void keypressed(Object o, KeyPressEventArgs e)
{
switch (e.KeyChar)//Here I made a breakpoint, but the debugger doesnt reach this point, when I
//press a button...
{
...
}
}
What's the problem?
MS Visual Studio.NET 2003
C#
|
|
|
|
|
Make sure the Form .KeyPreview property is set to true . There are some other good notes in the sdk documentation for Form .KeyPreview that you might want to check out.
I hope this helps--
--mike
|
|
|
|
|
Yeah, thanks.
That works.
MS Visual Studio.NET 2003
C#
|
|
|
|
|
I've started getting a very strange exception in my program.
An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module.
That happens sometimes when a window is created (not a specific window, has happened with messagebox and my own forms).
I am using .Net version 1.1. This is my first app with 1.1, so maybe there was some important detail I missed that has changed from 1.0 to 1.1?
I know threads and UI can cause a mess if done badly, but I am not doing any threading at all.
It seems that before the exception occurs, a new thread with no name is created.
VS cannot tell me anything about the thread: there is no call stack, the stack frame selector is unclickable... nothing.
|
|
|
|
|
Many threads are created that handle various things, like painting a control or for asynchronous operations. You never know.
Make sure you're compiling a debug build. There's other reasons you might not be able to use some of the debugging tools (threads are always funny when it comes to that), but just to eliminate the obvious I mentioned that.
If you think it has something to do with threading, check that your application's Main entry point is attributed with the STAThreadAttribute , which is the main UI thread. Usually, though, you get different errors if your application is started in anything other than an STA.
As far as changes 1.0 to 1.1, there really isn't much besides new methods and a few new classes, and a few methods and properties that are now obsolete - nothing conceptual is mentioned, though.
All I can think is to click on the Debug->Exceptions menu and break on all exceptions. Changes are that you'll end up looking at assembler code, but it should give you some stack frame if the debugging symbols are loaded. If you're not using a checked build of Windows, they are probably stripped. VC++ does install some program database (pdb files), but not for the core libraries. If you dig around though, you should at least be able to determine which library you're in. That could help solve the problem since most libraries are pretty specialized.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
OK, thanks for the help. I'll try and see what happens with all exceptions breaking into the debugger on throw.
|
|
|
|
|
(Not sure if i had to post this here, couldn't find a forums here more fitting, if it's supposed to go elsewhere please remove).
I just finished readying: "Teach yourself C# in 24 Hours, by James Foxall", it really was a nice book, but i feel there are parts it discussed that didn't "fill" my knowledge as much as i'd like. Could someone propose a book, a set of books, or a complete training course that it is best for, learning CSharp, understaning OOP as a concept, and taking you to the next level, an intermediate status to pro (well pro without a proffesional experience).
Thanks in advance
|
|
|
|
|
The next thing is to read all the .NET frameworks docs in MSDN from start to finish. That should keep you busy for a year or 2, but you will be a "pro" To reach the next level, you will have to study the EMCA-334/5 C#/.NET CLR specs to answer all your questions you have left After that stage, you can rename yourself to Heath Stewart or something :p
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Thanks ofr pointing these things out for me, but the problem is, i don't trust myself yet to start searching on my own, performing quantum leaps. Even with having finished that book and all the examples/tests in it, i cannot write a simple program on my own, without having 100 backdraws and stuff. Meaning i cannot make code decisions yet, i just type like a blind and hope that this will work. That's why i asked for a book/s that will help me answer questions ( that maybe now i don't know i have, but will surely stumble upon later), and will serve as a quide to get me on knowledge-train, then i will surely have to dig on MSDN library (and CSharp Dev center). And i am also lacking OOP knowledge (only thing i know is what i've read in this book) 'cause C# is the first "real" language i started studying, no c++ background etc.
So if there's a book/s that would fit my needs as i mentioned above, please help me make the right choice
p.s. What is ECMA-334/5 C#/.NET CLR (common language runtime)?
|
|
|
|
|
leppie wrote:
After that stage, you can rename yourself to Heath Stewart or something :p
Good call.
- Nick Parker My Blog
|
|
|
|
|
|
Sorry for this question but I'm looking for a quick answer.
How does .NET load assemblies? - or better how does .NET find the assemblies to load?
For example: if I have myexe.exe which uses mydll.dll myseconddll.dll, etc. does the runtime scan the folder containing myexe.exe for all .dlls and loads them? What if I have 1000 .dlls in a single folder? Will the runtime load them all or just will scan them all?
My exact question is: I want to organize my program like that
main.exe
system/system.dll
system/gui.dll
plugins/someplugin.dll
plugins/moreplugins.dll
As you might guess what is in ./system/ will always be available and used by main.exe but what is in ./plugins/ could be different.
What methods do we have available to load .dlls? I'm currently reading Sam Haidar's article on late binding. Are there any other methods?
Could you please point me to information, where I can find an answer about this question.
I hope my question is clear enough.
|
|
|
|
|
.NET will first look if an Assembly with the same version number is in the GAC, then it falls back to the working executable's directory
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
It also looks in the private path, which can be configured in the application's .config file using the <probing> element (see SDK documentation for details).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Well, I did plugin loading by first just listing all the DLL files in the plugins directory and then calling Assembly.Load() (I think that's what it was called) for each of them and specifying the file as the parameter.
|
|
|
|
|
Hello
I am creating a database which will be used to display information and pictures for houses. I have done everything but be able to insert the pictures and retrieve them from the database.
This is the code l am using to make the connection with the database
//Example Connection
m_cnADONetConnection.ConnectionString = @"Provider=Microsoft.jet.OLEDB.4.0;data source=C:\Houses";
m_daDataAdapter = new OleDbDataAdapter("Select * From Houses",m_cnADONetConnection);
OleDbCommandBuilder m_cbCommandBuilder = new OleDbCommandBuilder(m_daAdapter);
m_daDataAdapeter.Fill(m_dtContacts);
//This is what i am using to retrieve from the database, not sure how to do this for a image control.
txtHouseID.text = Rows[rowPosition]["HouseID"].ToString();
To select the picture l want to add to the database, l am using a open dialog box, which works, but l can't add it to the database.
Many thanks in advance
Steve
|
|
|
|
|
First, learn to use OleDbParameter . This will greatly aide in your problems. Second, set the column in which you want to store the image to an OLEObject.
Then, you need to be able to read the image from a Stream as a byte[] array and assign it:
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO SomeTable (Name, Image) " +
"VALUES (@Name, @Image)";
cmd.Parameters.Add("@Name", OleDbType.VarWChar, 40).Value = "ImageName";
cmd.Parameters.Add("@Image", OleDbType.Binary).Value = image;
cmd.ExecuteNonQuery();
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for your help
I was starting to read up on the stream. Could you give me a example how to read the image from a stream as a byte data.
I am interested in using the parameters more, as it seems to be very useful. Is there any good tutorial on them.
Many thanks in advance
Steve
|
|
|
|