|
Can you see how I can get this code to compile please?
public string SmtpServer
{
set
{
System.Web.Mail.SmtpMail.SmtpServer = value;
}
}
may be I should use something like:
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(value);
if so then how do I set SmtpServer?
Thanks
|
|
|
|
|
Hi,
I am converting a 1.1 code to 2.0
The line that I would like to convert is
System.Web.Mail.SmtpMail.SmtpServer = SMTPserverName;
P.S. using outlook
do you know what should this line be in 2.0 ?
Thanks
|
|
|
|
|
If you're using the System.Web.Mail classes, you're not using Outlook. You're using the CDOSYS library, or CDONT on NT 4.0.
In .NET 2.0, you can continue using System.Web.Mail which will continue to use CDOSYS/CDONT. The new version of the framework adds a new namespace, System.Net.Mail, which implements the SMTP protocol directly in managed code. To send mail, you need to create an instance of the SmtpClient class. You can pass the SMTP server name to the constructor.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I can not get this to work
public new void To(string email)
{
base.To = email;
}
the error is:
can not implicitly convert type string to system.net.mail.mailaddresscollection
Thanks
|
|
|
|
|
The To property is a collection, so you need to say base.To.Add(email);
I'm not that familiar with System.Net.Mail - I only really know that it exists. I've used System.Web.Mail a couple of times.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have made a client-server application, and I would like to have a messenger like popup message just over the taskbar on the client, that will notify me when ever changes has been made on the server.
How do I make this popup notifycation?
I hope someone can help... thanks
modified 2-Feb-21 21:01pm.
|
|
|
|
|
i had created a taskbar pop up
u can use the following code
u need to add this form in ur project and call it when
u want to display the pop up message
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Reflection;
namespace TaskBarPopUp
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
private string contenttext;
Timer timer;
bool Displayed = false;
private System.Windows.Forms.Label lblContent;
Point po;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.BackColor = Color.CornflowerBlue;
lblContent.BackColor = Color.CornflowerBlue;
this.Opacity = 0;
timer = new Timer();
timer.Interval = 100;
timer.Tick += new EventHandler(timer_Tick);
po = new Point(MousePosition.X,MousePosition.Y);
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.lblContent = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblContent
//
this.lblContent.Font = new System.Drawing.Font("Bookman Old Style", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblContent.Location = new System.Drawing.Point(0, 0);
this.lblContent.Name = "lblContent";
this.lblContent.Size = new System.Drawing.Size(368, 96);
this.lblContent.TabIndex = 0;
this.lblContent.Text = "This is a Pop Up";
this.lblContent.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblContent.MouseEnter += new System.EventHandler(this.lblContent_MouseEnter);
this.lblContent.MouseLeave += new System.EventHandler(this.lblContent_MouseLeave);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.ClientSize = new System.Drawing.Size(368, 93);
this.ControlBox = false;
this.Controls.Add(this.lblContent);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form1";
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.TopMost = true;
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public string Content
{
get{return contenttext;}
set{contenttext = value;}
}
public void SetContent(string str)
{
lblContent.Text = "You Have Received A Message From \n"+ str;
contenttext = str;
}
public void Show(int TimeToShow, int TimeToStay, int TimeToHide)
{
}
private void lblContent_Click(object sender, System.EventArgs e)
{
}
private void Form1_Load(object sender, System.EventArgs e)
{
Rectangle workArea = Screen.GetWorkingArea(this);
SetBounds(workArea.Width - this.Width-5,workArea.Height - this.Height, this.Width , this.Height);
timer.Start();
}
private void timer_Tick(object sender, EventArgs e)
{
if(Displayed == false)
{
this.Opacity += 0.1;
if(this.Opacity == 1)
{
Displayed = true;
}
}
else
{timer.Interval = 1;
if(po.X >= this.Location.X && po.Y >= this.Location.Y)
{
timer.Stop();
}
if(this.Opacity >=0.1)
this.Opacity -= 0.01;
if(this.Opacity >= 0 && this.Opacity <= 0.1)
{
timer.Stop();
Application.Exit();
}
}
}
private void lblContent_MouseLeave(object sender, System.EventArgs e)
{
lblContent.ForeColor = Color.Black;
Displayed = true;
this.Opacity = 1;
timer.Start();
}
private void lblContent_MouseEnter(object sender, System.EventArgs e)
{
string txt = lblContent.Text;
lblContent.ForeColor = Color.White;
timer.Stop();
Displayed = false;
this.Opacity = 1;
}
}
}
|
|
|
|
|
|
I have developed a TextBox Control with some customized features by inheriting the Default TextBox Control. The problem is, when i added the control to the form the designer fails to show any control in the form including the developed control. But the designer can show all the controls if i remove that control. How can i provide design time support to the control so that is remains visible in design time .
Thanks in advance.
|
|
|
|
|
have u added the textbox control through the code ?
if u have done this way the textbox will not be visible during
the design time.
but it will be visible at runtime.
Regards,
Pramod
|
|
|
|
|
I need a form that will popup next to a button. For instance, say I have a volume button on a form but I dont want to put the controls for the volume on the form. Instead, I push the volume button and a little form pops up next to it that has all of the necessary volume controls. Furthermore, I dont want it to perform like a conventional form. I dont want it to show up in the task bar and I need its location to always be next to the button that instantiated it. I have seen this on several applications, including Fireworks and Photoshop. Any ideas? Thanks.
P
|
|
|
|
|
u can create a form and set it's ShowInTaskbar property false,
and call the Show method of the form in the MouseDown of the Button.
later u can access the form and do as u wish
Regards,
Pramod
|
|
|
|
|
Yeah, that is what I was going to do. I just didn't know if there was a better way of doing it. Thanks for your help.
|
|
|
|
|
Hey,
I wanna display an image on the background of a form...thats easy enough, just set the form.backgroundimage to the image.
The problem is I also want to to scroll down the image if its bigger than the form, i set form.autoscroll to true, yet I still can't scroll down, up or side to side.
How can I sort this out, or what control would work better, the picture box control poses the same problem.
Thanks for the help
|
|
|
|
|
hi!
In the ShowDialog, is there a way to set the modality of the form into a parent form only not to the whole application?
i used the ShowDialog(IWin32Window) overload, still it's application modal.
but if i use the Show method and disabled the Parent form this solves the problem, but the process of the parent continues after the form is shown. Unlike in the ShowDialog, it freezes the parent's process until you close the modal form.
so is there any way to make this somewhat a combination?
- Form Modal
- freezes the parent's process when the modal form is shown & resumes when it's closed.
any suggestions is very much appreciated.
thanks in advance!
|
|
|
|
|
i think this can be solved by making the parent form as MDI and
the form that u want to display as the MDI child of the parent form.
hope that works for u
Regards,
Pramod
|
|
|
|
|
the child form is like a messagebox. that shows message, only modal to the owner/parent form and executes the next statement of the owner after it's close.
that's why it doesn't solves my problem.
i don't use the .Net's messagebox because i want some other controls on it.
anyway, thanks for your reply!
i really appreciate it!
|
|
|
|
|
What actually are u trying to do?
if u are using a form to display the message then u can
make that message form as the MDI child of the form from
where u are calling this message form.
if u can explain ur problem in more detail..
Regards,
Pramod
|
|
|
|
|
hi pramod!
sorry for the late reply.
actually, my main goal is to create a custom message box. I don't want to use the normal messagebox because it's very limited with regards to functionality and design. that's why i just created a normal form.
i already read some articles about making a custom messagebox and most of them are using the ShowDialog method. Which is ok because it will become modal to the owner form and the next statement after the showing of the messagebox is executed after the messagebox is closed.
but there is a problem in this method... the modality of the messagebox is for the whole application not for the owner only.
for example, i have 2 forms in the application, Form1 and Form2. Both of them are loaded.
the Form1 shows the messagebox, which means it's the owner and you cannot access it until you close the messagebox. So Form2 must be accessible, but this is not what happen. both of the forms are not accessible.
there's an overload of the ShowDialog which has an IWin32Window parameter for setting the owner. but it's the same as the one with no parameter.
so as a solution for the modal thing, i just set the owner of the messagebox, then use the Show method and disabled the owner. but there's a problem with this(again?
the execution of the statements, after showing the messagebox, continues even if the messagebox is stil loaded.
so as a summary, here's what i want(if possible... )
Option 1
- Use ShowDialog method
- Set the modality of the messagebox to the owner only (how???)
Option 2
- Use Show method and disabled the owner
- freeze the process of the owner until the messagebox close (how???)
hope that explains well...
thanks for your time!
microsoc
|
|
|
|
|
The first thing that i would like to know is y do u want to display 2 forms at one time in ur application. I think the flow should be such that only one form is accessible at one time.
But even then if u want to do it then it seems to be a tricky one
need to try this
i'll try if this is possible and then let u know
Regards,
Pramod
|
|
|
|
|
Hi,
can u tell me from where does ur form 2 gets the call to
display?
if it's from form1 then u cannot solve it
but if form2 is called from some other form u can access it.
Please send the details what is ur application about
i have tried it.
Regards,
Pramod
|
|
|
|
|
thanks for your reply!
Actually, it's a windows application but Internet Explorer hosted so the one that loads the forms is the IE.
there will be an instance/scenario that you want to open more than one forms at a time, for some transaction purposes to validate some data. Anyway, so for example there would be an error occured or a message asking for confirmation for something in one of the openned forms(that's where the messagebox comes in the picture), then when you don't want to close the messagebox yet and go to the other forms or launch another, you can't do that because the messagebox is modal for the whole application.
so that's the purpose of the customized messagebox.
hope that's what you want to know.
thanks for your time!
microsoc
|
|
|
|
|
I'm looking for any topic or code that can help me understand xls parsing. I'm trying to read from excel file, re-format some data and save it to xls file again. I'll be really really thankful for any kind of help.
|
|
|
|
|
http://swish-e.org/archive/2005-06/9778.html
|
|
|
|
|
Hello everybody,
I've created a filesystemwatcher in windows service. I want to store files that have been changed into MS Access. The problem is the data is not inserted into database after the event handler is fired. Any suggestion that can solve this problem?
Thanks in advance,
hongweng
|
|
|
|