|
Nice use of design patterns, Heath!
I tend to agree. Trying to "new" an object in an unmanaged DLL would be ugly, if it were even possible.
Jeremy Kimball
|
|
|
|
|
Hi,
Can anyone tell me how to add intellisence descriptions to an object, function, and or property? I think it has something to do with adding text in [] above a object, function, or property but that's just a guess.
Thanks
|
|
|
|
|
XML Comments are your friend.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|
|
You must document your source (or go through the pain-staking process of writing an XML document that conforms to the standards, which is difficult and your source should be documented anyway) and generate an XML document from it. For instance, do something like this:
public class MyClass
{
public MyClass()
{
}
public int SomeMethod(int param1)
{
return param1 + 1;
}
} In VS.NET, right-click on your project and select Properties. Set the configuration to "All Configurations" (recommended) and find the Configuration Properties/Build section. Specify a name in the "XML Documentation File". If you don't specify a path (so just a filename), the filename is written to the build directory (like bin\Debug or bin\Release depending on the build configuration at the time of compiling). This is the same as the /doc option for the csc.exe command-line compiler.
See Recommended Tags for Documentation Comments[^] for more information. You can use any tags, but you should at least use these (like many documentation compilers like NDoc[^] that I help with will also recognize <b> tags, <p> tags, etc.).
When you deploy your assembly, make sure the generated XML document has the SAME name as the assembly, only that is has a .xml extension instead of .dll. VS.NET (and other editors of any decent value) will query for this file and use it to display comments for your assembly in the source editor.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I looking for using a modem in c#.
I generate a tone signal in function the quality of a signal that I want to ear from a GSM for pointing an antenna.
If anyone have a link or sample to using a modem with c# is great.
Best Regards
youssef
|
|
|
|
|
There is no class in the FCL for serial modem comm. You can use a 3rd party .DLL to get to a modem and control it over a COM port.
Try http://www.marshallsoft.com/wsc4vb.htm[^] for a shareware version with examples.
RageInTheMachine9532
|
|
|
|
|
There was an article and base class in an issue of msdn magazine for RS232 communications in .Net. I am currently using this class with great success however no for modems but multiple serial devices. There is modem specific functionality within it though.
http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/default.aspx
Should be fine with licencing issues as well.
|
|
|
|
|
I have a C# web service that runs fine until after some number of calls have been made. After this every attempt to call any method generates the following SOAP exception
[thread 0x6a4] Unhandled exception generated: (0x04ab6e7c) <System.Web.Services.
Protocols.SoapException>
code=(0x04ab6068) <System.Xml.XmlQualifiedName>
actor=<null>
role=<null>
detail=(0x04ab6d54) <System.Xml.XmlElement>
subcode=<null>
_className=<null>
_exceptionMethod=<null>
_exceptionMethodString=<null>
_message=(0x04ab645c) "Server was unable to process request. --> Timeout expir
ed. The timeout period elapsed prior to obtaining a connection from the pool.
This may have occurred because all pooled connections were in use and max pool s
ize was reached. " If I restart the server or restart IIS, things get cleaned up and functioning again. Until some number of calls occurs again and I'm back to the restarts. I suspect that some pool needs cleaning up, but I'm not sure how to cause this to happen automagically. Any ideas? Thanks.
Chris Meech
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
VB is like a toolbox, in the hands of a craftsman, you can end up with some amazing stuff, but without the skills to use it right you end up with Homer Simpson's attempt at building a barbeque or his attempt at a Spice rack. Michael P. Butler
|
|
|
|
|
Make sure that if you're using database connections, you're closing all connections (returning them to the pool, if pooled) when done. You can use the using keyword in C# to automatically dispose (and close) these, or manually code to what the using keyword would compile:
SqlConnection conn = null;
try
{
conn = new SqlConnection("...");
}
finally
{
if (conn != null) conn.Close();
} If you're not manipulating databases, could you provide a few more details about your implementation?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hit the nail on the head. The class that implements the web service methods establishes a database connection in it's ctor. I haven't included a dtor to close the connection.
Thanks for the advice.
Chris Meech
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
VB is like a toolbox, in the hands of a craftsman, you can end up with some amazing stuff, but without the skills to use it right you end up with Homer Simpson's attempt at building a barbeque or his attempt at a Spice rack. Michael P. Butler
|
|
|
|
|
If I want to delete a contact in XML using C# I can do this:
XmlNode deleteContact = contactDoc.SelectSingleNode("descendant::Contact[FirstName='Sanddy']");
contactDoc.DocumentElement.RemoveChild(deleteContact);
But I want to make a textbox where I give in the name and then that person is deleted, but I can't find how to do it.
Thx in advance
|
|
|
|
|
Same way your doing it.
<br />
string strXPath = "descendant::Contact[FirstName='{0}']", txtBox.Text;<br />
XmlNode deleteContact = contactDoc.SelectSingleNode(strXPath);<br />
contactDoc.DocumentElement.RemoveChild(deleteContact);<br />
|
|
|
|
|
How is ulong ulong (64 bit c int) marshaled? Do i just put them in a sequential structure? Or is it more complicated than this?
I'm currently trying to marshal it like this:
[StructLayout(LayoutKind.Sequential)]<br />
public struct cLargeInt<br />
{<br />
public int low;<br />
public int high;<br />
}
But i get a lot of funny results.
Cheers
Cata
|
|
|
|
|
Just marshal it as a long (Int64 ) or ulong (UInt64 , and not CLS-compliant).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I need to build an MDI application. After opening forms as MDI Child if I need to open further form from those MDIChild form it don't follow MDI Application. So how can i make a form as MDI child of the form which is already an MDI child.
Thanks for ur support
Inpreet Singh
|
|
|
|
|
The .NET Framework - and the underlying Windows Management APIs - do not support this. You should rethink your application design. You should also read the Windows User Interface Guidelines[^]. Such a design would be confusing for more users anyway. One common approach would be to bind controls to a hierarchical list (like a TreeView ), similar to Mozilla preferences. There are several articles here on CodeProject about such a UI as well.
If you require this type of UI, then like many other applications with custom UIs you must design all the supporting APIs yourself.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You can't. A form cannot be an MDI Parent and Child at the same time. In other words, you have an MDI Parent that has children. None of those children can be an MDI Parent to another child form. You can't do this:
MDI Parent Form
|
+--->MDI Child Form
|
+--->MDI Child Form
|
+--->MDI Child/Parent Form <---Illegal!
|
+--->MDI Child Form
|
+--->MDI Child Form
RageInTheMachine9532
|
|
|
|
|
I don't know a lot in this area, but couldn't you create your main parent, child and also another parent that is a copy of that child and make the child call the 2nd level parent?
|
|
|
|
|
Hello,
I am using datagrid to show my records. now column width is set by default. which could be resized but that doesn't look good presentation. so can anybody tell me how can I resize my datagrid column width.
Thank you For ur support.
Inpreet Singh
|
|
|
|
|
Search for DataGridColumnStyle class to find examples.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
See the DataGrid.TableStyles Property[^] documentation in the .NET Framework SDK for a detailed review of how to explicitly define table and column styles. For instance, if you use a DataSet (and assign the DataGrid.DataMember to the appropriate table name within the DataSet ) or DataTable for the DataGrid.DataSource property, you create a new DataGridTableStyle with the MappingName set to the table (you can also set it to specially formatted names for non-DataSet data sources, but see the documentation for more information). You then add DataGridColumnStyle s to the table style that map to your column names. You can specify captions, column widths, string formats (for numbers, dates, etc.), and more. You can also define your own.
The VS.NET DataGrid designer also does a great job of helping you if you assign your DataSet at design-time to the DataGrid.DataSource (using the DataSet to create an instance of some strongly-typed DataSet defined in your current or dependent project). Even without, click on the "..." button next to the TableStyles property and explore.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi,
i'd like to test some function about file properties.
my question is meta information of file. when we use a file and find a one, we can see [Properties] menu in Popup. There included many information , such as file name, application, file size, LastAccessTime etc. we can see this information by [General Tab].
i think FileInfo or Directory Class is very commonly use to develop this info.
but more important information is summary Tab. you know this tab consists of Description(title, subject, category, keyword etc) and source(author, update etc)..I am afraid i don't have any idea to develop this function. how to write this kind of information in my application?
I amnot sure FileVersionInfo Class have provided some function. but just read option.
I'm so confused how to write...
Please help me..
|
|
|
|
|
This information is stored in alternative data streams and uses IPropertyStorage implementations. This is a COM technology and is not available in the .NET FCL (Framework Class Library). I am writing a library at the moment that wraps all this in easy-to-use .NET classes, so I guess you could just watch my profile for updates to articles. Believe me, it's not easy (and a lot of P/Invoking and COM re-declaration is necessary).
If you want, read the article Accessing Alternative Data Streams of files on an NTFS volume[^] here on CodeProject. Summary information is commonly stored in "\005SummaryInformation" ("\005" is an octal escape sequence for character #5). You can also read more about the IPropertyStorage and IPropertySetStorage on MSDN[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I want to make windows explorer type treeview/listview structure.
In treeview user can add node, delete node, Edit Node.which are then stored in database and can be reterive from database using combobox to show root.
In listview details for selected node can be displayed.
also user can resize both views by dragging seperator b/w treeview n listview like v can do in windows explorer. I mean how can v resize both views.
Inpreet Singh
|
|
|
|
|
This is not a short solution and is not suitable for a forum. It is possible, but you have to provide a heck of a lot of functionality to get it to work (and you'll find that the TreeView in the FCL sucks, but it should work for what you need it seems).
Search CodeProject for solutions, though. I know I've seen a few that create and synchronize TreeView controls with database content. You should also try googling[^].
Some third-party controls already have this capability as well, or at least make it easier. Most aren't very expensive and if you're coding this for any commercial deployment will be most cost-effective if you try and buy these. I recommend the appropriate controls from either http://www.devexpress.com[^] or http://www.infragistics.com[^], both of which I have experience with and like. We use Infragistics UltraWinTree in our product, but only because at the time it was the only choice.
Microsoft MVP, Visual C#
My Articles
|
|
|
|