|
Hi all,
Doing an app which enables me to write a message and send it via email. I chose to use my gmail account. Here is the code...
private void button1_Click(object sender, EventArgs e)
{
try
{
MailMessage mail = new MailMessage("fromMe@gmail.com", "toRecipient@hotmail.com", "testing subject here", txtMessage.Text);
SmtpClient emailClient = new SmtpClient("smtp.gmail.com",586);
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("myusernameHere@gmail.com", "mypasswordHere");
emailClient.UseDefaultCredentials = true;
emailClient.Credentials = SMTPUserInfo;
emailClient.Send(mail);
lblStatus.Text = "email sent";
}
catch (Exception ex)
{
lblStatus.Text = ex.Message;
}
}
I keep getting a "Failure sending mail" exception.... something must be missing or wrong... any ideas please? Cheers
|
|
|
|
|
I was wondering that, is there any way to access windows clipboard data within a windows service(managed) without using named pipe/IPC ?
Any kind of suggession would be helpful. Thanks in advance.
|
|
|
|
|
All,
I have encoded an object that contains a Generic array at it's heart. One of the uses I have for this is to store double[] arrays at each index point. I have done this rather than using multidimensional arrays as the class containing the generic array has additional functionality I need that multidimensional arrays don't provide.
Everything works but complications arise because the double[] arrays that get loaded into the generic array are not full, ie. they need to be updated on the fly. Because of the nested nature of the arrays I want to update I've realised that std indexing won't work. if anyone can offer some guidance on the best approach ere i'd appreciate it. Or, do I have no choice but to unload the array at each index point in order to update it?
A brief snippet of my code for guidance:
public class CircularQueue<t>;
{
private T[] QBuffer; // Generic Array
public T this[int Index] // Indexing code
{
get
{
if ( (Index < 0) || (Index >= QBuffer.Length) )
{
}
return QBuffer[Index];
}
set
{
T Item = value;
Insert(Item, Index);
}
} // End Index
...
}
Declaration:
protected CircularQueue<double[]> CustomData;
Usage:
CustomData.Initialize(SizeOfGenericArray); //Initialize
CustomData.Enqueue(IndexItem); //Add an item(double[])
CustomData[GenericArrayIndex][ItemIndex] = NewValue; //This fails!
So the indexing code I have is useful only for indexing the generic array. Indexing the nested arrays is more of a problem. Any help offered willl be greatly appreciated.
Regards,
Dave
Regards,
Dave
|
|
|
|
|
I don't see anything wrong with the code.
What do you mean when you say that it "fails"? What happens? Do you get a compilation error? A runtime error? In what way does the result differ from what you expected?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I'm (finally getting around to) having a look at the IDataErrorInfo interface, which has two properties with get accessors. One of them looks like this:
public string this[string columnName]
I haven't seen this syntax in a property before, so: how does it work? Why is there a this ? What does it do? Why is [string columnName] surrounded in square brackets? How can this syntax be used in other aspects of one's program?
|
|
|
|
|
This is an Indexer. See this link[^] for more information.
If you have an array (or some other indexable values) in your class, then you can access them directly via an index to your class, instead of accessing the underlying array directly.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Dear Friends,
In my System is Disabled USB Drive through BIOS and BIOS has Password Set.
now i want to enable and Disable My USB Drive without going to BIOS settings.
is it Pssible to enable and Disable USB Drive Through C# ?
or in some other way?
i have searched about this , in some places thay are mentioning about
Register key value.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet \Services\UsbStor
at my system it is already ennabled.
how to do that?
Please help me
With Love
Joe
|
|
|
|
|
It cant be done.
What you are trying to do is like changing a wheel of car while going 100mph. Not possible.
|
|
|
|
|
I can change the wheel of a car going at over 1000mph
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
|
Hi.......
Every is possible ......
Try this code for disable and enable USB MASS STORAGE
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
private void button1_Click(object sender, EventArgs e)
{
RegistryKey delKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\USBSTOR", true);
delKey.SetValue("Start", "00000004",RegistryValueKind.DWord);
MessageBox.Show("USB MassStorage Disabled");
}
private void button2_Click(object sender, EventArgs e)
{
RegistryKey delKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\USBSTOR",true);
delKey.SetValue("Start", "00000003", RegistryValueKind.DWord);
MessageBox.Show("USB MassStorage Enabled");
}
|
|
|
|
|
I have a dataset with thousands rows i want to devide it in multiple datasets can any one tell me the solutions.hanx
|
|
|
|
|
can you please specify the situation where you want to do this ?
|
|
|
|
|
Why did you ask this, delete your post, and ask it again ?
Why do you need a dataset with thousands of rows ? Wouldn't it be better to ask for the data in the form you want it ? Why do you need to break it up ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Can someone tell me or refer me to an example of how to print data from a datatable please? I need to get the data from a data table and print it in a report. Thanks.
|
|
|
|
|
use Crystal report
wasim khan
|
|
|
|
|
Best option, use Crystal Report and print it as your custome format
|
|
|
|
|
hi have to print my datagrid values like this........
Printed out should be like
Pepsi 500ml £1.09 coke 500ml £1.09
Fanta 500ml £1.09 Sprite 500ml .99p
but i am getting print out like......
Pepsi 500ml £1.09
coke 500ml £1.09
Fanta 500ml £1.09
Sprite 500ml .99p
|
|
|
|
|
Wow - I answer your question, so you repost it ? Why didn't you respond to my answer ? It's clear to me from the code you posted that you're getting by copying and pasting code you find on the internet and do not understand. If you remotely understood the code you posted, this change would be trivial for you. Either way, I explained how to do it.
If you don't understand something when it's explained to you, ask on the same thread. Don't repost, it makes you look rude, and it also leaves us with the feeling that you're looking for a complete cut and paste solution because you're too lazy to learn how to do it yourself. I can write this code for you, but I prefer to encourage people to learn for themselves. That tends to help people who want to be programmers, and cut out people who just want to take on work and get us to do it for them.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
sorry one of my frind posted it again...
|
|
|
|
|
You have two people sharing an account, and trying between you to work out how to print items in two columns ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
now i got some idea from u thank u very much
|
|
|
|
|
>>Sorry my friend posted it again.
Who is your friend?
cse.vidiya>>It's another bot.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
|