|
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.
|
|
|
|
|
As I've explained before, and IntPtr is nothing more than a managed pointer. The number of digits is inconseqential. The pointer is a 32-bit memory address so it could have up to 10 digits in the number. How cares? It's still an address.
You have to get the string using the IntPtr . Once again, a string is nothing more than an array of characters, so this address points to the first character. The problem you're probably running into is handling ANSI and Unicode characters incorrectly. If you know the string will be ANSI, use Marshal.PtrToStringAnsi . Use Marshal.PtrToStringUni for Unicode and Marshal.PtrToStringBSTR for BSTRs (wide characters). If the character encoding is platform dependent, use Marshal.PtrToStringAuto . Note that the last will not automatically figure out what character encoding is in use; it will use ANSI for Windows and Unicode for Windows NT.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yeah, I tried constructing 3 string holders and ran each type of convertion on the returned IntPtr to test it, but I got 3 gibberish results.
It's got me stumped.
Cata
|
|
|
|
|
Sorry Heath, my mistake.
When i pulled the item off the clipboard, i forgot to apply GlobalLock to it. The IntPtr i got from the lock produced a fully valid string. So all is well.
Cata
|
|
|
|
|
I have a Web application which use Web Service.I have built some classes,include property class which define the propeties of a specific object and DataBase Accessing class which is used to operate the DataBase.
The Question is
i don't know where should I place these classes. At the Web application solution or at the Web Service solution.
|
|
|
|
|
If this operartion should happen in server obviously you add it to web service solution and use it there and call it from your web methods. Is that what you mean?
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Thanks for your reply.
i am a chinese.Maybe my statement is not clear.
I place the methords which operate DataBase on the Web Service.
but where the property class should i place?
the property class is like this
class Product
{
private int id;
private string name;
.....
}
If i also place them on the Web Service,will it add the burden of Web Service?
|
|
|
|