|
Can anybody help me to know how to send emails using C#.NET v1.0. Please provide me necessary coding to perform this.
I am a student
|
|
|
|
|
|
http://dotnetopenmail.sourceforge.net/faq.html
Above link is to open source C# library for sending e-mails with attachments, as HTML, Text, etc.
It works fine in .NET 2.0, and I can't find anything on SourceForge or the home site above that says it DOES NOT WORK on 1.1, or 1.0, but if you have any doubt go to the Forums on the page linked to above and post a message.
best, Bill
"The greater the social and cultural distances between people, the more magical the light that can spring from their contact." Milan Kundera in Testaments Trahis
|
|
|
|
|
Hi all. My C# app registers itself using the IStillImage interface, and the RegisterLaunchApplication method, such that when we connect a camera, our program is listed in the box that comes up, and from there we can run the software. Recently, it's become the case that launching the app this way causes it to freeze, although running it normally never does. There are no parameters passed through, nothing should run any different to if I double click on the app. What happens is, it shows a second thread in task manager, which, if you go to the process, goes to explorer.exe. This thread is the only one not responding at first, then the other one also dies, and Windows informs you that you need to close the app, etc. There is definately no visible UI to go along with the other thread.
Any suggestions are most welcome.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ThreadingApartment?
|
|
|
|
|
Hello,
With following code i can filter (with the GetSodas sql-query) data out of my database, and get the total of records which can be found.
int totaal = aanbodTableAdapter.CountSodas().Value;
So far so good.
Now, I want to get 1 single record (which i filter by the id) out of the GetSodas-query.
I tried this:
button1.Text = aanbodTableAdapter.GetSodas().FindByid(1).description;
But I get an error:
<br />
System.NullReferenceException was unhandled<br />
Message="Object reference not set to an instance of an object."<br />
What do I do wrong?
Thanks!
|
|
|
|
|
Well, you should first break this down so each call is on a new line. Then work out where you're getting null, and you can try to fix it from there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't really know what you are trying to say ..
I know exactly where I get the error (as said in first post), but I can't fix it ..
|
|
|
|
|
JelleM wrote: know exactly where I get the error
No, you do not.
button1.Text = aanbodTableAdapter.GetSodas().FindByid(1).description;
button1 could be null. There's two method calls and a property call, each of which could fail due to a null reference. So, you need to call GetSodas, place the result in a variable. Then use that to call Findbyid. Then, access the description property. FindByid would be my guess, but it's best not to guess, make sure, then you know where to look.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah idd, I thought you were talking about where in the code
I tried:
<br />
button1.Text = aanbodTableAdapter.GetSodas().ToString();
button1.Text = aanbodTableAdapter.GetSodas().Count.ToString();
So the problem is in the findbyid ..
I tried different id's also (0,9, ..), but always that error :s
Can you help?
Tnx!
-- modified at 17:38 Thursday 4th May, 2006
|
|
|
|
|
OK, so it's the call to get by ID. Now, how is all of this hanging together ? You said 'SQL question', have you written any SQL anywhere ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Except from the queries I made: No.
But because it's about retreiving data from the database, i named the title that way ..
I don't know what findbyid really does (which id?), the thing is I don't find a similar function in the list that also gets one single row out of the query ...
|
|
|
|
|
|
I don't really know what you are trying to say.
I just want to "filter" one single row out of multiple rows.
int total = aanbodTableAdapter.GetSodas().Count // total = f.e. 21
I got to find a way how to reduce the 21 results (rows) in the above code, to 1 single (specific) row?
|
|
|
|
|
Are you looking to get a specific row by a primary key, or a specific row by value? From what I see, it appears that aanbodTableAdapter has no ID field of "1". The FindBy* is generated by a dataset(I'm assuming you're using one), and the * is the primary key(or keys) of the table. If the primary key doesn't exist, the findby will return null, so preforming any operations on a null datarow will fail.
Try debugging and set a breakpoint right before you make that call to check the state of your tableadapter to make sure its A) Filled, and B) has an ID key of the value you think it should.
|
|
|
|
|
Hey Drew,
Sorry for the late response.
It doesn't really matter, it's the goal to put the "function" in a loop and the loop just has to assign all "description"-values to the different buttons-Text-value(so it can be another method, I don't care, something like I suggested seemed the most logical to me).
Thanks!
-- modified at 4:55 Tuesday 9th May, 2006
|
|
|
|
|
led mike
|
|
|
|
|
I'm writing a custom control (Visual Studio 2003, C-Sharp). This is a very simple control that draws a circle or a polygon. The control exposes two properties: ShapeStyle and ShapeSides. ShapeStyle is an enumerated property that can be either "Circle" or "Polygon". If the user picks "Circle" from the IDE Property Grid, the control draws a circle. If the user picks "Polygon", then the control will use the value in ShapeSides (an integer) to sketch a triangle (3 sides), square (4 sides), pentagon (5 sides), etc.
I don't want the "ShapeSides" property displayed on the PropertyGrid, if "ShapeStyle" is set to "Circle". I don't think I can change a Property Attribute programatically.
Below is the code for the control. Any help will be greatly appreciated.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace TestApp
{
public class ShapeControl : Control
{
private Container components = null;
private Color shapeColor;
private ShapeStyle shapeStyle;
private int shapeSides;
public ShapeControl()
{
base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor, true);
this.shapeColor = Color.Red;
this.shapeStyle = ShapeStyle.Circle;
this.shapeSides = 4;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
pe.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
int minSide = Math.Min(pe.ClipRectangle.Width, pe.ClipRectangle.Height);
PointF center = new PointF((pe.ClipRectangle.X + pe.ClipRectangle.Right - minSide)/2f, (pe.ClipRectangle.Y + pe.ClipRectangle.Bottom - minSide)/2f);
RectangleF rect = new RectangleF(center, new Size(minSide, minSide));
if (this.shapeStyle == ShapeStyle.Circle)
{
pe.Graphics.FillEllipse(new SolidBrush(this.shapeColor), rect);
}
else
{
PointF[] points = new PointF[this.shapeSides];
for (int i = 0; i < this.shapeSides; i++)
{
points[i].X = (float) (minSide/2f*Math.Cos(i/((float) this.shapeSides)*Math.PI*2)) + center.X+minSide/2f;
points[i].Y = (float) (minSide/2f*Math.Sin(i/((float) this.shapeSides)*Math.PI*2)) + center.Y+minSide/2f;
}
pe.Graphics.FillPolygon(new SolidBrush(this.shapeColor), points);
}
}
#region Component Designer generated code
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
protected override Size DefaultSize
{
get { return new Size(200, 200); }
}
[Category("Appearance")]
[DefaultValue(typeof (Color), "Red")]
[Description("The shape color.")]
public Color ShapeColor
{
get { return this.shapeColor; }
set
{
this.shapeColor = value;
this.Invalidate();
}
}
[Category("Appearance")]
[DefaultValue(typeof (ShapeStyle), "Circle")]
[Description("The shape style.")]
[RefreshProperties(RefreshProperties.All)]
public ShapeStyle ShapeStyle
{
get { return this.shapeStyle; }
set
{
this.shapeStyle = value;
if (this.shapeStyle == ShapeStyle.Circle)
{
}
this.Invalidate();
}
}
[Category("Appearance")]
[DefaultValue(4)]
[Description("The shape number of sides.")]
[Browsable(true)]
public int ShapeSides
{
get { return this.shapeSides; }
set
{
if (value > 2)
{
this.shapeSides = value;
this.Invalidate();
}
}
}
}
public enum ShapeStyle
{
Circle,
Polygon
}
}
|
|
|
|
|
|
hi,
i m new to Visual Studio 2005 and i m developing a windows application in c#.
I m facing a problem in which i have to pass reference of the calling form (frmCityMaster.cs) to called form (frmList.cs).
The form frmList.cs has a datagrid control (dgList) which displays all the data of the table citymaster, and the form frmCityMaster has a int variable iMasterId and a method EDITMASTER() to load all the data about a city for editing purpose based upon the variable of the variable iMasterId.
COnsider the following programming case, i want to pass the reference of the calling form (frmCityMaster) to the called form (frmListMaster) so that i m able to set the variable iMasterId value with the city selected in the row of the datagrid (dgList) on frmList.cs... And also i want to call the method EDITMASTER() on frmCity.cs from form frmList.cs...
The above presented problem is just one of the n possiblilities that may occur and this i know can be easily solved by passing the reference of the form frmCityMaster.cs to the calling form frmList.cs but my question is what if the calling forms are dynamic i.e. the calling forms can be any from say frmCityMaster.cs, frmStateMaster.cs or say frmCountryMaster.cs each having a iMasterId as an integer variable to hold the PRIMARY KEY value of the current row from database table and EDITMASTER() method to fill the form controls with the current database master record based the current iMasterId value.
And now that i want to pass the reference of the calling form say frmCityMaster.cs or frmStateMaster.cs to called form (frmList.cs) form so as to be able initialise the calling form's iMasterId variable and EDITMASTER() to initialise the current PRIMARY KEY values.
How can i achieve this using C# Visual Studio 2005. My database server is SQL Server.
abhinav
|
|
|
|
|
abhinish wrote: i have to pass reference of the calling form (frmCityMaster.cs) to called form (frmList.cs).
No you don't. http://en.wikipedia.org/wiki/Object-oriented_programming[^]
You can use things like encapsulation, interfaces and software design patterns to make the appropriate information available accross different forms or anything else.
led mike
|
|
|
|
|
Since all of the "calling" forms have a field called iMasterId and the EDITMASTER method (why all caps??) you could create a base form which all of the calling forms derive. That base form would contain those two members.
But that's really weird.
What you probably should do is have the "calling" form initialize itself, instead of passing itself to another form to be initialized. The initialization details of the form should not be known by other forms, that's bad OOP.
In the future, it would be much easier for people to understand your question if you were to leave out a lot of irrelevant details. For example, if the controls on a form and the names of those controls is not relevant to the question, there's no need to mention them.
Josh
|
|
|
|
|
I am working in an application where I have the Visio Screen, come from: AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl.
Everything is correctly functioning, but when I print the PrintDialog screen is not appearing with the configurations of printer, the flowchat sent direct for the standard printer.
The problem is that the PrintDialog accept only the document of the type "System.Drawing.Printing.PrintDocument" and the document generated of the Visio is of the type "Microsoft.Office.Interop.Visio.Document".
I did not find a PrintDialog that has accepted this type of Document.
Somebody can help me?
Nícolas Santana
|
|
|
|
|
Hi,
I'm trying to do something that seems pretty easy. I have a xml string that I want in a datatable. After some testing, I think the biggest problem is getting the schema into a new datatable from a xml string.
public void XMLStringToDataTable(string as_xml, ref DataTable adt_working)
{
if (adt_working == null)
adt_working = new DataTable();
StringReader lstr_temp = new StringReader(as_xml);
XmlTextReader lxmlReader = new XmlTextReader(lstr_temp);
adt_working.ReadXmlSchema(lxmlReader);
adt_working.ReadXml(lxmlReader);
adt_working.AcceptChanges();
}
Is there any easier/ better way to do this? One that works? I would like to use a datatable instead of a dataset if possible.
sample xml string:
<?xml version="1.0" standalone="yes" ?><d_edit_mod><d_edit_mod_row><contr_fund_id>6229</contr_fund_id><contr_id>190</contr_id><fund_mod_dt>5/4/2006 00:00:00</fund_mod_dt><fund_mod_no>2</fund_mod_no><fund_mod_reason>test</fund_mod_reason><fund_mod_eff_dt>5/4/2006 00:00:00</fund_mod_eff_dt><fund_initial_load>N</fund_initial_load><fund_mod_type_cd>1647</fund_mod_type_cd><fund_mod_status>1678</fund_mod_status></d_edit_mod_row></d_edit_mod>
Thanks, Jessica
|
|
|
|
|
Hi.I have actually an element ComboBox with two items A & B.How can I manage to change the view of my plot which is generated from ZedLibrary control by chosing this two items?I mean that I have two different plots A and B.best regards
|
|
|
|