我想通过gmail服务器发送电子邮件.我已经输入了以下代码,但它在发送时卡住了.请问....
MailMessage mail = new MailMessage();
mail.From = new System.Net.Mail.MailAddress("apps@xxxx.com");
//create instance of smtpclient
SmtpClient smtp = new SmtpClient();
smtp.Port = 465;
smtp.UseDefaultCredentials = true;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
//recipient address
mail.To.Add(new MailAddress("yyyy@xxxx.com"));
//Formatted mail body
mail.IsBodyHtml = true;
string st = "Test";
mail.Body = st;
smtp.Send(mail);
Run Code Online (Sandbox Code Playgroud)
xxxx.com是Google应用中的邮件域.谢谢...
我有一个gridview,我用它来显示数据集结果.问题是我在其中使用分页.但是,当我点击页面#时,它表示我没有处理该事件.我需要重新绑定数据集???
谢谢
我有一个有图像的表格.我正在使用滑块来更改图像的不透明度.所以在滑块的"ValueChanged"事件中,我调用以下方法来更改不透明度.
//Setting the opacity of the image
public static Image SetImgOpacity(Image imgPic, float imgOpac)
{
Bitmap bmpPic = new Bitmap(imgPic.Width, imgPic.Height);
Graphics gfxPic = Graphics.FromImage(bmpPic);
ColorMatrix cmxPic = new ColorMatrix();
cmxPic.Matrix33 = imgOpac;
ImageAttributes iaPic = new ImageAttributes();
iaPic.SetColorMatrix(cmxPic, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
gfxPic.DrawImage(imgPic, new Rectangle(0, 0, bmpPic.Width, bmpPic.Height), 0, 0, imgPic.Width, imgPic.Height, GraphicsUnit.Pixel, iaPic);
gfxPic.Dispose();
return bmpPic;
}
Run Code Online (Sandbox Code Playgroud)
返回的图像设置为原始图像.
我的问题是图像的不透明度没有变化......如果有任何错误,请善意指出.. Thnx ......
我有一个应用程序,其中文本字段中的值被发送到数据库.
例如,我有一个带有一个字段的表单(文本框).当我按下Ok按钮时,文本字段的内容将作为记录插入到表中.我只是修剪文本框的文本并将其解压缩为变量并将其传递给我的SQL字符串.
问题是,无论何时"It's"或"Friend's"之类的单引号都被标识为字符串的结尾.在Delphi中,我看到过QuotedString
要避免这种情况的事情.你的任何想法?
我正在修改delphi app.In它我从组合框中获取文本.问题是,当我将文本保存在表中时,它包含一个回车符.在调试模式下,它显示如下.
newStr := 'Projector Ex320u-st Short Throw '#$A'1024 X 768 2700lm'
Run Code Online (Sandbox Code Playgroud)
然后我就放了
newStr := StringReplace(newStr,'#$A','',[rfReplaceAll]);
Run Code Online (Sandbox Code Playgroud)
删除'#$ A'的东西.但这并没有消除它.
有没有其他方法可以做到这一点..
谢谢
我有一个Dictionary对象需要写入XML文件.字典包含String类型作为Key,自定义类的Object(从System.Windows.Forms.Control派生)作为Value.
namespace SharpFormEditorDemo
{
[Serializable]
public static class common
{
public static Dictionary<String,CommonControl > dicControls = new Dictionary<string, CommonControl>();
public static Object objSelected = new Object();
public static int ctrlId = 0;
//The serialization and Deserialization methods.
public static void Serialize(XmlTextWriter xmlTextWriter,Dictionary<String,CommonControl> dic)
{
xmlTextWriter.WriteStartDocument();
ControlSerializer file = new ControlSerializer(dic);
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ControlSerializer));
xmlSerializer.Serialize(xmlTextWriter, file);
xmlTextWriter.WriteEndDocument();
}
}
Run Code Online (Sandbox Code Playgroud)
CommonControl类是这样的
namespace SharpFormEditorDemo
{
public class CommonControl : System.Windows.Forms.Control
{
//private List<String> controls;
private String sql;
private int minVal; //Minimum …
Run Code Online (Sandbox Code Playgroud) 我有一个类,我从System.Windows.Forms.Control派生
[Serializable]
public class CommonControl : System.Windows.Forms.Control,IXmlSerializable
{
Run Code Online (Sandbox Code Playgroud)
基本上这个类为默认的Controls类添加了一些属性.我的问题是我无法将Control对象强制转换为我的自定义控件对象.由于customcontrol类派生自Controls,我认为它可能有效.
我正在做这样的演员.
CommonControl ctrlTemp = new CommonControl();
ctrlTemp = (CommonControl)((Control)ctrl);
Run Code Online (Sandbox Code Playgroud)
这里的ctrl是一个Label对象.当我调试第一次铸造工作正常.
(Control)ctrl
部分.但是在(CommonControl)((Control)ctrl)
调试时它会显示以下消息.
(CommonControl)(ctrl)无法将'ctrl'(其实际类型为'System.Windows.Forms.Label')转换为'SharpFormEditorDemo.CommonControl'SharpFormEditorDemo.CommonControl
我通过读取XML文件动态生成Windows窗体表单.(实际上我开发了一个单独的工具来序列化Windows窗体表单及其组件.)
如何找出每个控件所在的容器控件?
例如,如果我是动态创建标签,我想查找它是否在组框或任何容器内.有可用的房产吗?
我有一个ADO.NET数据集,由某个查询设置,比方说
SELECT ID,USER,PRODUCT,COUNT FROM PRODUCTION
Run Code Online (Sandbox Code Playgroud)
如果不使用where子句,我需要从数据集中获得一些结果.假设我想获得具有最大产品数量的用户的用户和产品计数.(我想通过使用现有数据集来实现.我无法从数据集中获取它.)
想知道在数据集内查询的方法吗?由于有数据表,我的想法是有一些方法来查询它.
我有一个从母版页继承的aspx页面.在母版页中,我有一个按钮,该按钮对于解决方案中的每个页面都是通用的.
<div class="btn_general_mid">
<asp:Button
ID="btnMainSearch"
ValidationGroup="MainSearch"
OnClientClick="CheckSearchTextBox()"
CausesValidation="true"
runat="server"
OnClick="btnMainSearch_Click"
CssClass="search_btn_submit"
Text="Search" />
</div>
Run Code Online (Sandbox Code Playgroud)
这里CheckSearchTextBox()
是一个javascript函数,btnMainSearch_Click
它是处理按钮部分后面的代码的事件.
在某个页面btnMainSearch_Click
中,不会触发此按钮单击事件.(调试器未达到代码中的那个)
在运行时(使用Firebug检查时),这是为按钮生成的代码段.
<div class="btn_general_mid">
<input id="ctl00_btnMainSearch"
class="search_btn_submit"
type="submit"
onclick="CheckSearchTextBox();WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$btnMainSearch", "", true, "MainSearch", "", false, false))"
value="Search"
name="ctl00$btnMainSearch"></div>
Run Code Online (Sandbox Code Playgroud)
实际上在此按钮工作正常的其他页面中,为此按钮生成相同的html输出.我在这里错过了什么吗?