|
Or you could have two projects that build the same code.
|
|
|
|
|
Hi
I am trying to send an e - mail message. I have supplied the wrong network - credentials so that an exception would hopefully be thrown.
However, no exception is thrown. I find this very strange.
Heres my code:
mailMsg.Subject = m_Subject; // Subject of the E - mail.
mailMsg.Body = m_Content; // Content of the E - mail.
mailMsg.IsBodyHtml = true;
mailMsg.BodyEncoding = System.Text.Encoding.UTF8;
mailMsg.To.Add(m_Address); // The address to which the e - mail message must be sent.
mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.Never;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(serp_URL);
System.Net.NetworkCredential netCred = new System.Net.NetworkCredential();
netCred.UserName = serp_LoginName;
netCred.Password = serp_Password;
smtp.Credentials = netCred;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
try
{
smtp.Send(mailMsg);
}
catch (System.Net.Mail.SmtpFailedRecipientException)
{ // Or any other exception for that matter.
return false;
}
Any help would be greatly appreciated.
ChristiaanS
|
|
|
|
|
I have a similar problem, but I'm providing an invalid recipient address instead. I want an exception to be thrown, but none is. After attempting to send my message, I later got an email message from the SMTP server saying the mail was undeliverable (as expected). It seems that the SMTP server accepts the bad email and closes the connection with your program, so your program thinks everything is ok. Then, the SMTP server actually tries to deliver the mail. Does anyone know of a workaround so that your program knows whether or not the message was successfully delivered?
Thanks
|
|
|
|
|
Hi,
Can anybody tell how to change the value from database into some other language like Italian,French etc. i.e I want to make my site multilingual
|
|
|
|
|
i think maybe for the site you should use the resourses file (*.resx) and to properties set the Localizable to True,
and for the DB maybe you should redesign and add columns to the table for the extra language or you should think about other posibilites for ex. you set the languages in one table and add a column to table with the ID of the language that you are currently using. it can be done with the relationship tables..
hope it will help..
spaps
|
|
|
|
|
Hi! I´m trying to translate Vba call method from .dll. But if i translate it it won´t be the same in C#.
The code in VBA:
Public Sub SnodAnrop()
i = Module1.snod25x(host, port, user, pass, cert, cacert, service, arg, extra, result, buf)
End Sub
Declare Function snod25x Lib "sn25.dll" Alias "****" (ByVal Host As String, ByVal Port As String, ByVal User As String, ByVal Passwd As String, ByVal Cert As String, ByVal CAert As String, ByVal Nodtjanst As String, ByVal Arg As String, ByVal Extra As String, ByVal Result As String, ByVal Resultbuf As Long) As Long
The translation to C# have i done like this:
[DllImport("sn25.dll", EntryPoint = "****")]
static extern int snod(string host, string port, string user, string passwd, string cert, string CAert, string Nodtjänst, string arg, string extra, string result, int buf); private void button1_Click(object sender, EventArgs e) {
int i = snod("", "", user, pass, "", "", service, arg, "",result, 1024);
}
The problem is now is the string "result" in VBA returns info, but in C# it doesn´t collect any info at all. Int i returns a status value wich is 0 that meens OK. The problem is that i dont get any info back with the string "result" in C#
How Would u translate it? Have i missed something?
Im pretty new in C# so explain easely. Would Appriciate some help!!!
Thanks!!!!
|
|
|
|
|
|
Bold text is used to emphasise something. Please don't do this to everything that you write.
For a method to be able to update a string parameter, you have to use the ref keyword to send the parameter by reference.
I'm not certain if you have posted the correct VBA code. It's sending the parameter by value, which would not make it possible for the function to update the string.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Your problem may be resolved by using a StringBuilder for the result buffer and I'll point you to a reference showing the win32 api function GetWindowText which returns a string.
http://msdn.microsoft.com/en-us/magazine/cc301501.aspx[^]
[DllImport("sn25.dll", EntryPoint = "****")]
static extern int snod(string host, string port,
string user, string passwd,
string cert, string CAert,
string Nodtjänst, string arg,
string extra,
StringBuilder result, int buf);
You'd then call your function like this
StringBuilder sb = new StringBuilder(1024);
int res = snod(............, sb, sb.Capacity);
string resultStr = sb.ToString();
Also make sure that you know what type of encoding the result string uses, i.e. Ansi or Unicode and set CharSet appropriately in your DllImport attribute.
I'm not an expert at this so can't guarantee that these suggestions will work, but hopefully...
Alan.
|
|
|
|
|
I have created a widows service,register it and it is working fine.
Now i have created Windows application.RIght Click the solution and click add new item.I have added windows service compiled code and register using "installutil C:\mcWebService\bin\Debug\windowsapplication1.exe"
Now when i go to computer->manage->services and start service it gives following error
"Error: 1053 the service did not respond to the start or control request in timly fashion"
any body has solution for this
|
|
|
|
|
installutil is for Windows Services, not Windows Applications.
|
|
|
|
|
Then when we create windows aplication and right click to add new item and add windows service class then how this windows service will run
|
|
|
|
|
You either want a Windows Application or a Windows Service, you can't have something that's both.
If you want both and want them to interact, you'll need to create your own way to do that.
What are you trying to do?
|
|
|
|
|
Hello,
I am writing a regular expression to divide a CSS file into rules like this;
#DTEST
{
border-style:solid;
border-width:thin;
}
I want to repeat a part of the pattern to match all attributes enclosed between the tow braces
the pattern I want to repeat looks like this:
[\n\t\\s]*[a-zA-Z\\-]+[\\s]*:[\\s]*[a-zA-Z\\-]+[\n\t\\s]*
Dad
|
|
|
|
|
|
I want to repeat a part of the pattern to match all attributes enclosed between the two braces
the pattern I want to repeat looks like this:
[\n\t\\s]*[a-zA-Z\\-]+[\\s]*:[\\s]*[a-zA-Z\\-]+[\n\t\\s]*
How to repeat this pattern? this pattern allows application to validate only one attribute
like this
color:red;
but if there is a lot of attributes i don't know
How to make the pattern match them all?
Dad
|
|
|
|
|
Regex.Matches returns a MatchCollection , if more than one match is found. I don't see your problem!?!
|
|
|
|
|
Here you go, I even tested it for you...your pattern appears to work fine and dandy:
string input = @"#DTEST
{
border-style:solid;
border-width:thin;
}";
string pattern = "[\n\t\\s]*[a-zA-Z\\-]+[\\s]*:[\\s]*[a-zA-Z\\-]+[\n\t\\s]*";
MatchCollection mc = Regex.Matches(input, pattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
Console.WriteLine(mc.Count);
foreach (Match m in mc)
{
Console.WriteLine(m.Value.Trim());
}
|
|
|
|
|
Thanks a lot,
I know that the pattern works well in the way you use it for getting the attributes inside
these two braces {} but what I've failed to do is to match the whole rule like this:
#DTEST
{
border-style
: solid ;
border-width : thin ;
position:relative;
right:10px;
left:900px;
width:50px;
}
This is the whole pattern:
[\\.#]?[a-zA-Z0-9_]+[\n\t\\s]*{[\n\t\\s]*[a-zA-Z\\-]+[\\s]*:[\\s]*[a-zA-Z\\-]+[\n\t\\s]*;[\n\t\\s]*}
but it works only if the css rule contains only one attribute like this:
.Red
{
color:Blue;
}
the question is how can I let it match the css rule even if it has multiple attributes.
Dad
|
|
|
|
|
I want to select a member of TabControl by stroking keyboard but not by clicking the mouse on it.So,I think I have to create a shortcut key for that member.Can you tell me how to create it? Thanks
Hello Friends
|
|
|
|
|
with a keyboard event ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
if i understand correctly you want to make a event on e keypress no with a mouse ex. pressing the F* to raise the event that you want.
i think that in the form that you want to do the shortcut you have to enable keyPreview to True and on the keydown event of the form you should write that on what keycode it should raise this event.
ex...
if (e.KeyCode == Keys.F8)
{
write the code...
}
maybe it should help
spaps
|
|
|
|
|
hi,
i get an error when i try to remove the specific row ....which is following
Message = "Rows cannot be programmatically removed unless the DataGridView is data-bound to an IBindingList that supports change notification and allows deletion."
how can i change the data-bound configuration .
|
|
|
|
|
Hi,
I am developing an windows based application in which some print menu is present which prints the project information.
So i am using "PrintPreviewDialog" control in my application. But the problem is when there is no printer installed in my computer then it is not showing the preview.
but in microsoft word and others it is showing the preview so.
How to show print preview when no printer is installed on ur computer or no printer is connected to your computer. At least it should show the print preview. Is there is some method or some property.
I am using printdocument object in it.
Please guide me.
|
|
|
|
|
Is print preview enabled for Wordpad or MS Word on that computer?
I would just install a generic printer driver and it should work. The printer doesn't have to be plugged in to do a print preview.
|
|
|
|