|
Use NDoc[^], a project I'm proud to be a part of. It's used by many companies and can generate many types of documentation, with support for additional documentors. You can produce HTML Help 1.x and 2.x documentation that looks and pretty much acts exactly as the .NET Framework SDK documentation - consistency definitely helps.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yep, I've just started using NDoc, and it's great!
|
|
|
|
|
I am a beginner & was working on namespace system.web.mail. i was simply trying to mail a hello world message on the click of
a button. BUT when i tried to do it i got an error message as follows
System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server.
i have not configured my outlook express is it due to that, or is there some other problem. please help me. my code was as follows
private void button1_Click(object sender, System.EventArgs e)
{
sendemail();
}
public static void sendemail()
{
SmtpMail.SmtpServer = "www.hotmail.com";
MailMessage mm = new MailMessage();
mm.From = "casablancaknight@hotmail.com";
mm.To = "casablanca111@hotmail.com";
mm.Body = "hello";
mm.Subject = "hi";
SmtpMail.Send(mm);
}
|
|
|
|
|
You specified a web page as the SmtpServer . You need to provide the address to the SMTP server.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hey, in my application i have a designer like control wich i want to split
5 ways (horizontaly) , how can i do this? im curently using 4 splitters
but the movment isnt good, what is the right way to do this?
|
|
|
|
|
Hello,
i've tried to serialize a Class with member of type ArrayList but it doesn't work. The Xml Document is empty. What's wrong?
Code:
class ImageCollection
{
[XmlElement(Type = typeof(Image)),
XmlElement(Type = typeof(Image))]
private ArrayList images = new ArrayList();
ImageCollection()
{
}
public void addItem(Image image)
{
this.images.Add(image);
}
}
ImageCollection img = new ImageCollection();
img.addItem(new Image());
XmlSerializer serializer =new XmlSerializer(typeof(ImageCollection));
XmlTextWriter writer =new XmlTextWriter("Images.xml", System.Text.Encoding.UTF8);
serializer.Serialize(writer,img);
writer.Close();
Thanks and greets from Austria
|
|
|
|
|
If you read the documentation for the XmlSerializer class, it states that only public properties and fields are serialized.
It is recommended that you do not expose public, read-write instance fields, so I would recommend exposing a read-only property (only has a get accessor so other classes can't assign a new ArrayList ) and attributing that as yo've done for the private field.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath – I’m sure you’re reading this… I’m 95% of the way to a solution to the Explorer dragimage problem. That’s both good and bad news. First off, the problem all along wasn’t my implementation of the COM interfaces; I had that right the whole time. The problem is how c# registers objects as drag targets. It does it automatically, so you have to first revoke and then re-register the control for drag drop to catch the interface’s methods.
That being said, I have a test project which, when something from the shell is dragged over the form, will fire the IDropTarget.DragEnter event. I have an IDropTargetHelper object that I’m using to call the DragEnter method, and voila, the Explorer drag image appears! HOWEVER, I am getting a NullReferenceException when calling the IDropTargetHelper’s DragOver method, and the drag image will not move with the cursor since there's an error. I’ve scoured the net for a reason why this is happening, but no luck there. Debugging doesn’t help since we’re dealing with an unmanaged code…
Would you be willing to help in any way? I can post code, email a sample, whatever you might be up for... I’m so close I just need to get over this one last hurdle!!
Thanks!
|
|
|
|
|
Never mind... I found a work around for the problem
|
|
|
|
|
I want to write a program that will allow me to populate TextBox controls on other unknown applications from a Drag/Drop type event.
Exmaple: I open a Web page or other Dialog program that contains a TextBox, I would like to drag an Icon from my program over the target TextBox and fill the target TextBox with my own data.
Somthing similar was done in the password hacking Reveal program way way back, but rather than revealing passwords, I want to send data to the targeted Control. How do I get/send information from the target control ?
Can I use the Drag/Drop event to get the window name, then get the control handle from the window name somehow?
Any ideas out there ?
|
|
|
|
|
If you want to paste data into a textbox, you will need to get the handle to the window (i.e., textbox) you want to access and then send the appropriate message. I did something similar the other day in C++ with Outlook so I can get the count of the items within the Outlook address book. Here is an example of what I did:
HWND hwnd;
CString text, msg;
text = "Address Book";
hwnd = ::FindWindow(NULL, text);
if(hwnd != NULL)
{
HWND hwnd2;
hwnd2 = ::FindWindowEx(hwnd, NULL, "OUTEXVLB", NULL);
if(hwnd2 != NULL)
{
LRESULT num;
num = ::SendMessage(hwnd2, LB_GETCOUNT, (WPARAM)0, (LPARAM)0);
if(num == 1)
msg.Format("Results: %i entry.", num);
else if(num > 1)
msg.Format("Results: %i entries.", num);
else
msg.Format("Results: No results.");
SetDlgItemText(IDC_Results, msg);
}
else
{
msg.Format("Results: No results.");
SetDlgItemText(IDC_Results, msg);
}
}
else
{
msg.Format("No results.");
SetDlgItemText(IDC_Results, msg);
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
For this methodology, I assume you got the control name ("OUTEXVLB") via spy++ ?
I'm looking to get the handle for any TextBox based on the location of the mouse.
|
|
|
|
|
|
Start with looking up the documentation for Control.DoDragDrop() . The complicated part is detecting the start of a Drag-Drop-Operation; you probably already have that. OTOH, the simple part is providing string data for the operation.
private void sourceControl_MouseMove(object sender, MouseEventArgs e)
{
sourceControl.DoDragDrop(someText, DragDropEffects.Copy |
DragDropEffects.Move);
}
That's it! You drag something, and drop it over *any* Textbox/RTF-Box (Explorer, Word(pad)...).
|
|
|
|
|
Can I simple-bind an object that derives from System.Windows.Forms.UserControls class?
Thank you,
Brett
|
|
|
|
|
Bind data to it, or bind it's properties to something else? Please be specific, as this is a rather ambiguous question.
Both are possible, but rather than go into a length discussion of both, please be specific. Also take a look at the Control.DataBindings property in the .NET Framework SDK that gets installed by default with VS.NET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the response. I has more of an explaination here but didn't receive any replies.
I have created a UserControl which contains a ComboBox. This combo box if filled with data in the controls constructor. I created a public property to expose the ComboBox.SelectedValue property so I may bind to it from forms which use the control. The bindings never work. The debugger doesn't compain at all, and the values in the UserControl's ComboBox never changes with the CurrencyManager.Position changes.
|
|
|
|
|
Using the DataBindings property like so doesn't work?:
myUserControl1.DataBindings.Add("SelectedValue", dataSet1, "DataTable1");
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Correct, that binding will not work, hence my dilemma.
Neither of these work:
myUserControl1.DataBindings.Add("SelectedValue", dataSet1, "DataTable1");
myUserControl1.DataBindings.Add( new System.Windows.Forms.Bindings("SelectedValue", dataSet1, "DataTable1"));
Note, setting a value directly to the UserControl property does work.
Thanks for your assistence,
Brett
|
|
|
|
|
Both of those overloads to the same thing. The first actually uses the params to construct a Binding instance and then calls the second overload.
The thing about binding contexts is that they must be bound exactly the same. So, if you bind a ComboBox to a DataTable , then the Binding must also be bound to a DataTable .
I threw together a quick example. The ComboBox.DataSource is bound to a DataTable (in a DataSet ). The DisplayMember and ValueMember specify column names (say, "ID" and "Name").
I also defined a property (SelectedValue ) that reflects ComboBox.SelectedValue and created a binding in my ctor like so:
this.DataBindings.Add("SelectedValue", dataSet1, "Table1.ID"); The really important part is how you get the binding context. For the back and previous buttons, I threw together this:
private void button1_Click(object sender, System.EventArgs e)
{
CurrencyManager cm = (CurrencyManager)this.BindingContext
[this.dataSet1.Table1];
if (cm != null)
if (cm.Position >= 1) cm.Position--;
}
private void button2_Click(object sender, System.EventArgs e)
{
CurrencyManager cm = (CurrencyManager)this.BindingContext
[this.dataSet1.Table1];
if (cm != null)
if (cm.Position < cm.Count - 1) cm.Position++;
} Notice that the BindingContext is the table itself - the same as was bound to the ComboBox .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you. Before I dive into changing some things around, I have a question on the BindingContext. There are 3 TextBoxes and 2 UserControls which are bound to the same DataSet.Table (fyi, my dataset is typed). Would the way I get the BindingContext effect the binding between these three different controls? In other words, the binding is working fine on the the 3 TextBoxes but is not working on the 2 UserControls. If I:
<br />
string o="";<br />
BindingManagerBase bindingManager = this.BindingContext[DataSet, "table"];<br />
foreach(Binding b in bindingManager.Bindings)<br />
{<br />
o += b.Control.ToString() + "\n";<br />
}<br />
MessageBox.Show(o);<br />
The TextBox binding show, but the UserControls do not. And obviously, the Text boxes are bound and change with .Position property. Is there anything other that a set and get required on the UserControl for the binding to work?
|
|
|
|
|
Again, take a look at the BindingContext property documentation in the .NET Framework SDK. It's ncessary that you bind properties to the same data source as the BindingContext .
For example, many people will bind a DataTable to a DataGrid (assign it to DataSource ) instead of setting the DataSource property to the DataSet , and the table name (typed or not) as the DataMember name. If you then use specify a context like BindingContext[dataSet1.dataTable1] , it will not work. A good way is to use BindingContext[dataGrid1.DataSource, dataGrid1.DataMember] . This will make sure that the binding contexts are the same and correct.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am sorry, I don't see how this answers my question. The combobox bindings are being handled in the control. It is the 'simple data binding' to the UserControl's property I can't get to work. I don't think I would pull a BindingContext from [UserControl.myProperty] would I? I don't think I would get a useful binding manager that way. Thank you very much for helping me through this.
|
|
|
|
|
As I said in my previous reply[^], the binding contexts have to be exactly the same object with exactly the same data member (like a table name or collection property name or something). You can't bind to a DataTable in a DataSet in one case when the other binding is to the DataSet itself. I wrote a quick example and it works fine. If you reply to this via email (use the email link) I can grab your email address and send it to you to examine the source (you won't be able to run it since the connection string and command are specific to our database here, but you can always change it).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I tried someting new. I created a new UserControl, but instead of inheriting from System.Windows.Forms.UserControl I inherited from System.Windows.Forms.ComboBox (isn't this now a customcontrol??) Anyway this new user control binds without any problems. I bind to lp2.SelectedValue
Here are the basics.
<br />
public class lp2 : System.Windows.Forms.ComboBox<br />
{<br />
private SqlDataAdapter dataAdapter;<br />
private SqlConnection sqlConnection;<br />
private DataSet dataset;<br />
private System.ComponentModel.Container components = null;<br />
<br />
public lp2()<br />
{<br />
InitializeComponent();<br />
sqlConnection = Utilities.dbUtilities.getWebDbCn();<br />
string selectCommand = "select * from lang";<br />
dataset = new DataSet();<br />
dataAdapter = new SqlDataAdapter(selectCommand, sqlConnection);<br />
dataAdapter.Fill(dataset, "lang");<br />
this.DataSource = dataset;<br />
this.DisplayMember = "lang.langText";<br />
this.ValueMember = "lang.lang";<br />
<br />
}<br />
}<br />
My other UserControl is simular except I have a ComboBox added to the class where this class inherits ComboBox.
Now I guess I need to figure out how to get the older UserControl to work since I will be back to the issue when I have a UserControl with more than one control or component on it.
Are there things I must do in a UserControl to make sure I can bind to it's properties?
|
|
|
|
|