|
You could, but you'd have to make it:
myMonthCalendar.MaxDate = DateTime.Today.AddDays(1).AddSeconds(-1);
DateTime.Today is midnight last night, which gives the same problem on it's own.
But it's tidier with Today, I'll admit!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Thank you for the quick replies! I went with the “DateTime.Today.AddDays(1).AddSeconds(-1)” solution. Works great; thanks again!
|
|
|
|
|
You're welcome!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
As we can't see your code, we have no way other than randomly guessing.
|
|
|
|
|
I don't randomly guess, I try it!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
how to add coding to send Encryption text via smtp mail and this is the code. thanks
private void SendMail_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
{
MessageBox.Show("Require, must content the row !!!");
}
else
try
{
obj_SMTPClient = new SmtpClient("smtp.gmail.com");
Obj_MailMsg = new MailMessage();
obj_Attachment = new System.Net.Mail.Attachment(textBox7.Text);
Obj_MailMsg.From = new MailAddress(textBox1.Text);
Obj_MailMsg.To.Add(textBox3.Text);
Obj_MailMsg.Body = textBox5.Text;
Obj_MailMsg.Attachments.Add(obj_Attachment);
Obj_MailMsg.Subject = textBox4.Text;
SmtpClient smtps = new SmtpClient("smtp.gmail.com", 587);
obj_SMTPClient.Credentials = new NetworkCredential();
obj_SMTPClient.Port = 587;
obj_SMTPClient.Credentials = new System.Net.NetworkCredential(textBox1.Text, textBox2.Text);
obj_SMTPClient.EnableSsl = true;
obj_SMTPClient.Send(Obj_MailMsg);
obj_SMTPClient.EnableSsl = true;
obj_SMTPClient.Send(Obj_MailMsg);
MessageBox.Show("Message Successfuly Sent!!!");
}
catch
{
MessageBox.Show("Failed to Send Message!!!");
}
}
private void EncryptionText_Click_1(object sender, EventArgs e)
{
cipherData = textBox6.Text;
plainbytes = Encoding.ASCII.GetBytes(cipherData);
desObj.GenerateKey();
desObj.GenerateIV();
desObj.Mode = CipherMode.CBC;
desObj.Padding = PaddingMode.PKCS7;
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms,
desObj.CreateEncryptor(),
CryptoStreamMode.Write);
cs.Write(plainbytes, 0, plainbytes.Length);
cs.Close();
cipherbytes = ms.ToArray();
ms.Close();
textBox5.Text = Encoding.ASCII.GetString(cipherbytes);
}
private void DecryptionText_Click_1(object sender, EventArgs e)
{
MemoryStream ms1 = new MemoryStream(cipherbytes);
CryptoStream cs1 = new CryptoStream(ms1,
desObj.CreateDecryptor(),
CryptoStreamMode.Read);
plainbytes = new Byte[cipherbytes.Length];
cs1.Read(plainbytes, 0, cipherbytes.Length);
cs1.Close();
ms1.Close();
textBox5.Text = Encoding.ASCII.GetString(plainbytes);
}
|
|
|
|
|
What's the problem?
That's just code without any explanation of the help you need.
Remember that we can't see your screen, access your HDD, or read your mind, so we only get what you tell us to work on.
Help us to help you!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
This is a small problem to sending text without attachment file, need your help me??
|
|
|
|
|
It'd probably be easier to tackle both problems separately; mailing a text and encrypting a text.
So, what's the problem with above code? Does it throw an exception? Does it encrypt?
If you're having trouble decrypting the text on another machine, then take in consideration that you're generating a new key
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes, I will send encryption file using mail but code above only file attachment which sending. how to i adding the code to sending encrypt file without attachment. thanks
|
|
|
|
|
KaKoten wrote: how to i adding the code to sending encrypt file without attachment You're now encoding the text from "TextBox6", writing the result to "TextBox5". The contents of TextBox5 are written to the body, so I would expect it to encrypt the body.
If that works, then you'd only have to stop adding the attachment, and it would behave as requested.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
which only sending the attachment in this??
obj_Attachment = new System.Net.Mail.Attachment(textBox7.Text);
whereas which ignored by app is this and only side
Obj_MailMsg.Body = textBox5.Text;
how i add the code to sending only textbox5 which in encryption without attachment. thanks
|
|
|
|
|
KaKoten wrote: which only sending the attachment in this?? That line turns the content of the textbox into an attachment. Remove it if you're going to send mail without attachments.
KaKoten wrote: how i add the code to sending only textbox5 which in encryption without
attachment You don't need to add code to do that, only remove code. I assume that it IS encrypting the body correctly, and that you'd only want to remove the attachment.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
but I need the both without remove the both??
|
|
|
|
|
No, just the first
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
thanks, but there a good another idea
|
|
|
|
|
Question:
How do you read pairs of lines from reader to make entries in lookup, until the end of the file is reached, The two lines in a pair become the key and value for an entry in lookup.
Ex. if the remaining file lines are the four at the right, then two entries would be made in lookup, one with key "up" having value "down", and one with key "in" having value "out".
I'd like to use this function:
public static void FileToDict(StreamReader reader,
Dictionary<string, string=""> lookup)
{
}
This is what i've come up with so far.. I am totally lost. Help with anything please!
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
List<string>< list = new List<string, string="">()
{
"Up","down",
"In","out"
};
Dictionary<string, string=""> dictionary = values.ToDictionary(x=>, x =>true);
Foreach (KeyValuePair<string, string=""> pair in dictionary)
{
Console.WriteLine(pair);
}
}
}
}
|
|
|
|
|
First off, you should think more modularly; don't have the method accept the StreamReader, have it accept an IEnumerable of strings.
Secondly, don't have it accept the Dictionary and return void; have it return the Dictionary.
So look at System.IO.File.ReadAllLines[^] as a source of an IEnumerable of strings from a file.
Then you should know how to use String.Split or even a RegularExpression to get the values from the strings.
Then stick them into the Dictionary.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
awesome thank you for your help!
|
|
|
|
|
Hi,
I have created a user control with txtFirstName and txtLastName fields on it.
On my frmPassengers, I am populating the user control more than one time based on the number user decided to add like this:
private void frmPassengerDetails_Load(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
BaseLayoutItem prevItem = layoutControlPassenger.Root;
for (int i = 1; i < total_adults; i++)
{
ctlPassengers uc = new ctlPassengers() { PassText = "Passenger " + i };
LayoutControlItem item = layoutControlPassenger.AddItem("", uc, prevItem, DevExpress.XtraLayout.Utils.InsertType.Bottom);
item.TextVisible = false;
item.SizeConstraintsType = SizeConstraintsType.Custom;
item.MinSize = new Size(830, 75);
item.MaxSize = new Size(830, 75);
prevItem = item;
}
}
so if user choosed 5 for the total_adult value then the user control will be populated five times.
Now I want to know how can I read the value of every txtFirstName and txtLastName on the form (the five of it for example)..
Technology News @ www.JassimRahma.com
|
|
|
|
|
Add a list to your form (e.g. List<ctlpassengers>) to which you add your user controls as you create them. This avoids having to traverse the visual tree later to get at them.
Once you're ready to read back the name values, iterate over the controls in the previously created list.
|
|
|
|
|
sorry I didn't get you...
Technology News @ www.JassimRahma.com
|
|
|
|
|
txtFirstName and txtLastName are "text boxes" in your "user control"; right?
To access the text box contents (.Text) you need a reference to the users controls and the text boxes; no?
Aren't you creating these "user controls" on the fly and adding them to your (devExpress) form?
If not, what was the purpose of the code you posted?
|
|
|
|
|
You are right in all but in this case I am creating multiple controls from the same user control. The user control has just one txtFirstName but when users sets total_adults=5 in Form1 then five txtFirstName controls will be created on the Form2
Thats why I am asking how can I change the property class to return the value and from Form2 I need when clicking Save to save read the value of all fives txtFirstName controls.
Thanks
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
Add a list to your form:
list<uc> mylist = new list<uc>.
As you create and add uc's to the form, add them to the list also:
mylist.add(myuc)
When you click "save", iterate the list to access controls and their contents:
foreach ( uc myuc in mylist){
.... myuc.txtFirstName.Text ...
etc.
}
One set of controls; multiple "references" to those controls: form; list.
|
|
|
|