Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello every1!! :D
OK...sorry for asking so much questions, but I couldn't find help elsewhere... :(Here's the code that's causing problems:
public static string GetEmail()
{
return this.email.Text;
}public static string GetServer()
{
return server.Text;
}public static string GetVictim()
{
return victim.Text;
}It tells me:
C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\Form1.cs(414): Keyword this is not valid in a static property, static method, or static field initializerC:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\Form1.cs(419): The type or namespace name 'server' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\Form1.cs(424): 'SysInfoSender.Form1.victim' denotes a 'field' where a 'class' was expected
C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\MakeFile.cs(17): The type or namespace name 'source' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\MakeFile.cs(17): The type or namespace name 'source' could not be found (are you missing a using directive or an assembly reference?)
Why is it telling me this?? I've tried many things already, such as using "this.email.Text", or "this.InitializeComponent.email.Text" (which I didn't think would work...)
Thanx!! ;)El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx

First and foremost, a word on nettiquette: I spent a fair amount of time researching & answering your last question, and it's common courtesy to post back and let the person (and future readers) know if the response was helpful, if you found another solution, etc. It's very disappointing when you spend a long time on a question and never hear from the original poster again.
Anyhow, for this question, the keyword 'static' means that the function should be called without an instance of the class...You call it by the classname.functionname. Consider the difference between the following examples:
Math m = new Math();
int x = m.abs(-3);int x = Math.abs(-3);
Obviously, it makes more sense to put the 'abs' function as a static method, since there's no reason to create an instance of the 'Math' class.
So the problem with your code is that you've declared your methods as static, but you're referring to an instance ('this', in all three cases, although you only explicitly specify it in the first one) in a static method, which doesn't make any sense.
In short, remove the word 'static' from each method declaration and you should be fine.
-SN

I'm VERY VERY sorry for not answering...and u know what?? I've experienced sometimes that I post something, and when I come back, the post is gone...but this time, I didn't answer to the post kuz it didnt even show up on My Computing.Net!! :|
Sorry for not answering, soemthing's really weird around here... :@ :(But anyways...I removed the static keyword, and it asked me for an object reference, so I made one:
Form1.GetEmail gEmail = new Form1.GetEmail();
Form1.GetEmail gVictim = new Form1.GetVictim();
Form1.GetEmail gServer = new Form1.GetServer();
That gives me a BUNCH of errors, some repeated ones...here's one of each:C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\Form1.cs(419): The type or namespace name 'server' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\MakeFile.cs(21): 'SysInfoSender.Form1.GetEmail()' denotes a 'method' where a 'class' was expected
C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\MakeFile.cs(22): The name 'gEmail' does not exist in the class or namespace 'SysInfoSender.MakeFile'
C:\Documents and Settings\El-Trucha\My Documents\Visual Studio Projects\SysInfoSender\MakeFile.cs(23): 'SysInfoSender.Form1.GetEmail()' denotes a 'method' where a 'class' was expected
Why is this?? :(
Here's both Form1.cs and MakeFile.cs:
http://www.boredsource.com/eltrucha/files.zip
Thanx!! ;)And I'll look at the other post...thanx!! ;)
El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx

Fixed some stuff and it WORKED now!! :|
Lemme fix some file adding thing...and then I'll tell u if I get more errors...much thanx!! ;)El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx

I fixed almost everything now...thanx!! :D
One last thing...why do I get an exception about CDO.Message when trying to send mail?? look:
MailMessage emailMsg = new MailMessage();
// See MailMessage.SaveMessageToFile method to see
// how to save a whole message to a file
// Load the whole message from emailMsg.eml
emailMsg.Body = "This e-mail address can be used with SysInfoSender. ;)";
// Message properties can be overridden
emailMsg.To = email.Text;
emailMsg.Subject = "Testing...";
SmtpMail.SmtpServer = emailServer.Text;
SmtpMail.Send(emailMsg);
MessageBox.Show("Go check your inbox now. If you got the message, then you can use that email/server with this program. Otherwise, not. Sorry",
"Done...", MessageBoxButtons.OK, MessageBoxIcon.Information);While searching for a solution, I heard that CDO is not installed on all machines...but...can I override CDO?? I don't even know what it is... :P
Thanx!! ;)
(BTW, I uploaded my most recent code to the server)El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx

El-Trucha,
You may want to try the excellent:
HTML Entity Coder/Decoder
by Dr. Nick, available here:
http://golden-triangle.com/CODEPOST.htm
It will make your code easier to read in the forum.
M2If at first you don't succeed, you're about average.

MailMessage emailMsg = new MailMessage();
// See MailMessage.SaveMessageToFile method to see
// how to save a whole message to a file
// Load the whole message from emailMsg.eml
emailMsg.Body = "This e-mail address can be used with SysInfoSender. ;)";
// Message properties can be overridden
emailMsg.To = email.Text;
emailMsg.Subject = "Testing...";
SmtpMail.SmtpServer = emailServer.Text;
SmtpMail.Send(emailMsg);
MessageBox.Show("Go check your inbox now. If you got the message, then you can use that email/server with this program. Otherwise, not. Sorry",
"Done...", MessageBoxButtons.OK, MessageBoxIcon.Information);Hmm...I just pasted some other code and the post was wider... :(
But anyways, I used the program u told me, thanx!! ;)El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx

Didn't get to look at this until now...Can you post the exact text of the exception you're getting? Several things could be causing this (ISP not allowing routing to other mail servers, CDO not installed correctly, etc.) Maybe the whole exception will provide a clue.
Good luck,
-SN

I get this:
-----
An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dllAdditional information: Could not access 'CDO.Message' object.
-----Now...when trying to use another e-mail program for .NET which I got off CodeProject I think, "mail.bellsouth.net" works, but it doesnt get to my inbox!! :@
What do I do?? :(
Thanx!! ;)El-Trucha
http://www.truchasoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |