|
Hi,
I assume this is about System.Net.Mail.MailMessage, which has three properties (To, Cc, Bcc) of type MailAddressCollection.
you can pass such lists just like any other object, and it does not need a ref keyword; and the receiving method can enumerate, add, remove, and perform all operations that the list supports. The one thing you cannot do is replace the list by a different list (that is the only operation that would require you to use the ref keyword).
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Partial assumption is correct.....
This is the mailmessage as to what it will go to. That part of the application I have working. I am tweaking the (to,cc,bc) before I pass the parameter to the procedure handling the list. To allow for the ability for a popup window with 2 checkbox list boxes. To allow the end user to override or add to the list of email addresses the will be used to send the autogenerated email. It was a requirement being asked in the last second.
So I need to pass the 2 list variables into the popup form, allow the form to add/delete items from the list variable for the (to,cc,bc) email addresses. Then finally pass the new list objects back to the parent, replacing the parents list variables from the list variables received from the child.
|
|
|
|
|
Here is some of the code behind what I am doing before:
private void SendEmail(string AlertType, string Subject, string MessageBody)
{
string[] MailTo;
string[] MailCC;
string MailFrom = "it@peerassistllc.com";
List<string> EmailToAddress = EmailTo(AlertType);
List<string> EmailCCAddress = EmailCC(AlertType);
if (EmailToAddress.Count > 0)
{
MailTo = EmailToAddress.ToArray<string>();
MailCC = EmailCCAddress.ToArray<string>();
}
else
{
MailTo = EmailCCAddress.ToArray<string>();
EmailCCAddress.Clear();
MailCC = EmailCCAddress.ToArray<string>();
}
string smtpHOST = txtSMTPServer.Text;
int smtpPORT = Convert.ToInt32(txtsmtpPortNumber.Text);
string smtpNETAuthUser = txtsmtpServerAuthencationUserName.Text;
string smtpNETAuthPassword = txtsmtpServerAuthencationPassword.Text;
int i = 0;
string LogMessage = "Mail From: " + MailFrom;
if (MailTo.Length > 0)
{
LogMessage += " Mail To: ";
for (i = 0; i < MailTo.Length; i++)
{
LogMessage += MailTo[i] + "; ";
}
}
if (MailCC.Count<string>() > 0)
{
LogMessage += " Mail CC: ";
for (i = 0; i < MailCC.Length; i++)
{
LogMessage += MailCC[i] + "; ";
}
}
LogMessage += " SMTP Host Server: " + txtSMTPServer.Text;
LogMessage += " SMTP Server Port: " + txtsmtpPortNumber.Text;
LogMessage += " SMTP Server UserName Authencation: " + txtsmtpServerAuthencationUserName.Text;
LogMessage += " Message Subject: " + Subject;
StandardProcedures.SQL_Log(WhatIsMyConnectionString, AlertType, LogMessage, true);
StandardProcedures.SQL_Log(WhatIsMyConnectionString, AlertType, MessageBody, true);
if (MailTo.Count<string>() == 0 & MailCC.Count<string>() == 0)
{ return; }
ConfirmEmailReceipents(ref MailTo, ref MailCC);
StandardProcedures.NET_AuthenticatedMailSend(MailFrom, MailTo, MailCC, Subject, MessageBody, smtpHOST, smtpPORT, smtpNETAuthUser, smtpNETAuthPassword);
}
modified on Tuesday, October 20, 2009 8:25 PM
|
|
|
|
|
The ConfirmEmailReceipents is the process I need to work in passing my list to the child then back to the parrent to allow for modifications. Any Suggestions...
|
|
|
|
|
Here is the Code I am trying to get to work to pass the variable to pass between the parent and child...
private void ConfirmEmailReceipents(ref List<string> EmailTo, ref List<string> EmailCC)
{
using (frmpopupEmailRecipient popupVerifyEmailRecipients = new frmpopupEmailRecipient(ref EmailTo, ref EmailCC))
{
popupVerifyEmailRecipients.ShowDialog(this);
}
using ( frmpopupEmailRecipient f2 = new frmpopupEmailRecipient())
{
if( f2.Show() == DialogResult.OK )
{
f2.toEMAIL;
f2.ccEMAIL;
int i = f2.Number1;
string s = f2.String1;
}
}
}
|
|
|
|
|
I think I might of figured out how to pass the list to the child form. By Adding a Public List<string> in the child form. WOrking on testing that But now I have a somewhat new question....
How do I have the child form return the result of Dialogbox.ok?
I have set the child form's ok and cancel button's dialog property to the ok and cancel property. But I am unsure how to pass that to the parent form.
|
|
|
|
|
JollyMansArt wrote: allow the form to add/delete items from the list variable for the (to,cc,bc) email addresses. Then finally pass the new list objects ...
That is wrong, when you add/delete to a list (which is an object) it still is the same list (i.e. the same object, the difference is it may contain some other items).
For the rest, I'm not going to study all that, it is way too much code for anything you may want to do. And AFAIK some of it will not even compile.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
I figured out finally how to pass the array to the child and back...
Parrent Form:
using (frmpopupEmailRecipient popupVerifyEmailRecipients = new frmpopupEmailRecipient())
{
popupVerifyEmailRecipients.MyEmailTo = EmailTo;
popupVerifyEmailRecipients.MyEmailCC = EmailCC;
if (popupVerifyEmailRecipients.Show() == DialogResult.OK)
{
}
EmailTo = popupVerifyEmailRecipients.MyEmailTo;
EmailCC = popupVerifyEmailRecipients.MyEmailCC;
}
Child Form:
public partial class frmpopupEmailRecipient : Form
{
public List<String> MyEmailTo;
public List<String> MyEmailCC
}
Now optionally I would like for learning instead of just closing the frm... How do I modify the child form to return a dialogresult.ok value?
|
|
|
|
|
A Control (a Form IS a Control) offers the following methods amongst others:
public void Show()
public DialogResult ShowDialog()
and the MSDN page on ShowDialog clearly explains how the return value is determined.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
hi
how to make line after 2 rows in crystal report ?
ex:
aaaaaa
bbbbbb
------------------------------------
cccccc
ddddddd
------------------------------------
(working in C#)
thank's in advance
|
|
|
|
|
You create a formula field with below code and drag drop that field into ur crystal report detail section below ur data field, I hadnt checked may be it will work..<br />
<br />
<br />
Global booleanVar flag:=true;<br />
Local stringVar print ;<br />
if flag then print :="__________________________________";<br />
flag=false;<br />
if flag=false then<br />
flag:=true;<br />
print :=""
modified on Thursday, October 22, 2009 2:27 AM
|
|
|
|
|
You create a formula field with below code and drag drop that field into ur crystal report detail section below ur data field, I hadnt checked may be it will work..
shared booleanVar flag;
if flag then
(
flag:=false;
"";
)
else
(
flag:=true;
"__________________________________" ;
);
It will work !!!!!!!!!!!!!!!!!!
|
|
|
|
|
I need to get informed about every incoming network connection in C#.
All examples I found on the web were client/server stuff.
But I don't have any clients.
I want to get notified about all incoming connections at all ports.
How does it work? Which class can I use? Are there any events?
Thanks in advance for any hints and help.
Max
|
|
|
|
|
Wild Max wrote: Which class can I use? Are there any events?
.NET doesn't have an event that handles all incoming connections. Some connections are even made without the Frameworks' knowledge!
You could dive into the Firewall API, I believe that all connections pass through there.
I are Troll
|
|
|
|
|
string message = Timetable(doc);
public string Timetable(XmlDocument xmldocument)
{
string timetableResult = "";
if (xmldocument != null)
{
Output("Processing...");
using (StreamReader sw = new StreamReader(new FileStream("out1.xml", FileMode.Open)))
{
string str = sw.ReadToEnd();
//extraction and suppose there's a string here which I want to return
}
}
}
I can't seem to return a string, the error says :Could not load file or assembly 'RS232, Version=1.24.0.0, Culture=neutral, PublicKeyToken=515d87df384dcc81' or one of its dependencies. The system cannot find the file specified.
Please help.
|
|
|
|
|
Apparently, something in the code you are not showing is depending on a class in the RS232 library and that library cannot be found.
P.S. If the component from that library is a serial port and you are on .NET 2+, you could consider switching to the built in System.IO.Ports.SerialPort class.
|
|
|
|
|
Hi
i have a simple unBound field in my report designer named 'UnboundString1'.
i want to pass value to this field froom code, but i don't know how to do that. i also create a parameterField and use this code to pass value but nothing happened :
this.customersTableAdapter.Fill(this.northwindDataSet.Customers);
ParameterField myParam = new ParameterField();
myParam.ParameterFieldName = "UnboundString1";
ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();
myDiscreteValue.Value = "USA";
myParam.CurrentValues.Add(myDiscreteValue);
this.crystalReportViewer1.ParameterFieldInfo.Add(myParam);
this.CustomersReport1.SetDataSource((DataTable)this.northwindDataSet.Customers);
this.CustomersReport1.Refresh();
this.crystalReportViewer1.RefreshReport();
how to workaround this problem ?
|
|
|
|
|
Hi
i have a datagridview in a form that have a ComboBox column.
i want to send a value from an other form to datagridview combo box column.
i connected the combo box column to a table that show a member in Display Member
and return the Value Member but i dont know how to get the value in value member.
actually i lookin for something like SelectedValue in ComboBox Class.
how can i it?
thanks
|
|
|
|
|
The following code will get the value. You can ignore the fact that it is a DataGridViewComboBoxColumn for your purpose.
DataGridViewRow currRow = this.dataGridView1.CurrentRow;
this.txtValue.Text = currRow.Cells["CBColumn"].Value.ToString();
DataGridViewRow anyRow = this.dataGridView1.Rows[2];
this.txtValue.Text = anyRow.Cells["CBColumn"].Value.ToString();
DataGridViewCell currCell = this.dataGridView1.CurrentCell;
this.txtValue.Text = currCell.Value.ToString();
I have split the processing into two lines, and I would probably do this anyway because it is easier to understand. However, you could do it in one line, like this: (I have only shown the first one although you could do the same for all three)
this.txtValue.Text = this.dataGridView1.CurrentRow.Cells["CBColumn"].Value.ToString();
**NOTE**
'CBColumn' is the Name I have given to my DataGridViewComboBoxColumn , the Name property, not the HeaderText
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi group,
I'm converting a large old C++ program to C#. It has lots and lots and lots of istream/ostream io. Is there an equivalent io capability in C#? Any suggestions on the most efficient way to do this.
Thanks /Mike
|
|
|
|
|
The demo edition of our 'C++ to C# Converter' will allow conversion of some of the C++ IO methods/operators. Console.Write and Console.Read are used in addition to some helper methods for conversion of 'cin'.
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
|
|
|
|
|
There are tons of stream classes in C#. You should perhaps buy a C# reference.
If your C++ program includes extensions to iostreams, you're probably looking at a full rewrite of how you approach things.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks for the answers. Here is a code fragment I found here <http: www.java2s.com="" tutorial="" cpp="" 0240__file-stream="" performbothinputandoutput.htm="">
Is there c# support for this type of stream io?
<br />
#include <iostream><br />
#include <strstream><br />
using namespace std;<br />
<br />
int main()<br />
{<br />
char iostr[80];<br />
<br />
strstream strio(iostr, sizeof(iostr), ios::in | ios::out);<br />
<br />
int a, b;<br />
char str[80];<br />
<br />
strio << "10 20 testing ";<br />
strio >> a >> b >> str;<br />
cout << a << " " << b << " " << str << endl;<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
In C# i placed an rdlc report viewer on a windows form now when i make an object of the form it wont call the report viewer. please help if any .
<pre>
RdlcReportViewer rv = new RdlcReportViewer();
rv.<u>reportViewer1</u>.LocalReport.EnableHyperlinks = true;
rv.<u>reportViewer1</u>.LocalReport.ReportEmbeddedResource= "test.RdlcRptPayments.rdlc";
</pre>
thankx.
|
|
|
|
|
Have you looked at this? msdn[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|