|
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
|
|
|
|
|
Hello,
I am using Datagrid to show records and there are two buttons for Add new record and edit record. when add or edit button is clicked new form is opened where user enter data n after clicking ok on that form activation returns to datagrid form. Now the problem is, I want to execute UpdateGrid() method which shows updated data into grid. This can be called on Activated event of the form but if that form is MDI child Activated event does not work. so after editing or add new record I don't have any event to raise to update data into grid. If I don't make grid form as MDI child Activated event work properly but that doesn't fullfill my requirement. So plz could u tell me how to solve this problem. I tried making UpdateGrid() function as public and calling this function from add or edit on close event. but it haven't update my grid. Thank you for your support.
Inpreet Singh
|
|
|
|
|
Instead of handling events on the DataGrid , it's better to handle events on the DataSet if you're using one, or rather the DataTable (s) contained in the DataSet . The DataTable has many events (like RowChanged and RowDeleted ) you can handle. These are fired before or after (depending on which events you use) the underlying data source is updated. The DataGrid itself has no effective means to know when the data source was changed.
If you're not using a DataSet , you can either use appropriate events for the IList or IListSource implementation (like an ArrayList ) if any are exposed, or add events by extending the class or creating your own wrapper class.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey
I have a listview as a System Controller, that i have implemnted into a client server chat.
this listview is keeping trac of the online users and if thay are blocked or private or Public.
If the user is
private = the bakground on this row is painted blue
Public = the bakground is default(white)
Block = the backgraound is red
Problem:
when i start up the first client and joins it to the server, there is no problem al is woking fine, if i start up a second client and join the server, the first client as adding the user propely with the right background.
But the second client that just loggd on gets a strange update error with the bakgraound colors. It recives the user list and add the users thatwas loggdon before the second client, and in this case its just the first client.
The update error on the ListView in the second client is as following.
The bakground color that shows if the user is private,blockt or public is not painting properly, its only filling half of the rows with the colors, tha only way to get it updated is to move another window over the listvew and then it updates and show the proper colors.
Do you got any ide how i shold update my listview so this problem not accures? its strange that the first client is not getting the update error and only the second client.
//Jimmy
|
|
|
|
|
After adding your ListViewItem s, call ListView.Refresh (inheritted from Control ) to invalidate and repaint the client area. You can also call Invalidate with the bounds of whatever region you want to update, and then call Update . This is better for performance since the whole control would not require repainting.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have my STGMEDIUM class declared as followed:
[StructLayout(LayoutKind.Sequential)]<br />
public struct STGMEDIUM<br />
{<br />
public TYMED_Flags tymed;
public IntPtr item;
public IntPtr pUnkForRelease;
}
Where item is the item reffered to in the union. Now, generaly from experience i've never encountered an IntPtr that isn't exactly 7 in length (well, one that works).
However, when I call the GetData method of IDataObject, i get a 9 digit pointer, that does not provide me with any strings that are actualy on the clipboard.
I'm not sure, but i think i might be getting some value... uhm... over run? Where some of the numbers are taken from the previous / next item in the list.
If I copy a char string to clipboard, i get back a 4 char string of unrecognised charachters.
Can anyone see where this is coming from?
Cheers
Cata
Note: This is only obtained when looking up using HGlobal, I can get a valid pointer to IStream interface without problem.
|
|
|
|