keypresseventargs.char

Dani AI

Generated

This thread mixes two different issues (keyboard input handling and sending mail from C#) and needs clearer problem statements. When posting, state whether the code runs in a browser or a desktop app, the framework and language versions, the control or markup you are using, the exact error or unexpected behavior, and a minimal reproducible example. started the keyboard topic; asked for specifics; flagged the forum placement.

If the code runs in a browser (ASP.NET), keyboard handling must be done in client-side script; consult the browser KeyboardEvent API for consistent properties across browsers (KeyboardEvent.key). If this is a Windows desktop VB.NET app, handle the control's KeyPress/KeyDown events and inspect the event arguments on the form.

For sending email from C# on Windows, use System.Net.Mail on .NET Framework or a modern client such as MailKit for newer runtimes. Minimal .NET Framework example:

using System.Net;
using System.Net.Mail;

var message = new MailMessage("from@example.com", "to@example.com")
{
    Subject = "Test",
    Body = "Hello"
};

using (var client = new SmtpClient("smtp.example.com", 587))
{
    client.EnableSsl = true;
    client.Credentials = new NetworkCredential("username", "password");
    client.Send(message);
}

Troubleshooting: confirm host/port/credentials, use TLS on port 587 if required, check firewall/ISP blocks on port 25, and review provider-specific requirements. Microsoft guidance is here: . For modern .NET consider MailKit on GitHub.

Recommended Answers

All 3 Replies

man plz b specific-
This is not mobile to send message in the form of u want to use keypress(then use javascript)....

c# code for sending email in window vista

wrong forum

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.