Linq To Xml - Persisting MDI Child Position And State?

Sep 22, 2010

In a MDI WinForm I want to save each child window position and state, per application user, that is different by the logged in Windows user. My application has its own users; so I won't use the user settings like my.Settings... etc.One option is to read/write directly to the database, but I don't like the idea to access the database for something so trivial as the windows positions. The plus is that I could store that information independently by the machine where the user works, wherever she logs in, her preferences will be remembered.Another option, that I'd like to follow, is to use Xml to store that information in a file locally on the user's computer. The structure could be something like:

<form name="form name">
<Top>120</Top>
<Left>100</Left>[code]....

how this could be done; maybe using Linq to Xml? I've found I can write something as simple as

Dim formPos As XElement = _
<User><%= My.Application.connectedUser.id %>
<form1>[code].....

2) How to write the XElement when finished building it. Should I use an XmlWriter.Create? Hot to pass it the XElement?

3) What happens when in the Xml file there's already a node with the same name, I want to overwrite the previous user settings if they are already there, but not append to the file, nor rewrite the entire file, of course.

View 1 Replies


ADVERTISEMENT

VS 2008 Stopping A MDI Child Form Loading In A Maximized State

Sep 28, 2010

I have an MDI Form that contains an MDI Child form. On this child form is a flexgrid. When the user double clicks on a row in the flexgrid this loads another MDI Child form. I have set the following properties on the second child form:

FormBorderStyle = FixedDialog
MaximizeBox = False
MinimizeBox = False
StartPosition = CenterScreen
WindowState = Normal

The problem is that if the first MDI child form is in a maximized state and the user double clicks on the flex grid, the second child form loads in a maximized state too! How can I stop this?

View 4 Replies

VS 2008 Stopping An MDI Child Form Loading In A Maximized State?

Jan 16, 2009

I have an MDI Form that contains an MDI Child form. On this child form is a flexgrid. When the user double clicks on a row in the flexgrid this loads another MDI Child form. I have set the following properties on the second child form:

FormBorderStyle = FixedDialog
MaximizeBox = False
MinimizeBox = False

[code].....

View 2 Replies

Filter Parent / Child Table In Linq Query Based On Entities In Child Table?

Jul 9, 2010

I have a table (Projects) which is linked to projectVersions on projectID..projectVersions contains several columns on which I'd like to filter a returned project (and associated projectVersions) list. For example there is a "capacity" column and a "country" column. I am doing a filtered list of projects on one page and I'd like to include all projects where any one of the associated projectVersions has a capacity of 750ml and a country of "France" for example.It may be that a particular parameter is not set and so I pass a zero to indicate not to filter on that.I guess this needs some kind of subquery as when I try and do something like this: [code] it doesn't work as the "xxx" bit, being one-to-many, expects me to specify an item to get at the entities within and yet I want to query where ANY of the associated versions match one of the criteria.

View 1 Replies

Start Position Of Child Form?

Jan 21, 2011

In the form property i set CENTER TO PARENT but its not working then i also write a code but still form not shown in the center

Private Sub About_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles About.Click
Dim aboutdev As New aboutaut()
aboutdev.MdiParent = Me

[code]....

View 1 Replies

VS 2008 : Getting The Position Of A Child Control?

Jan 22, 2011

In your opinion what API use Spy++ to get the "Rectangle" and "Restored Rect" data of a child control of an external window?I don't think it uses GetWindowPlacement because if I use this API for the main window I obtain the same values of Spy++, but if I use the GetWindowPlacement API to find the position of a control of the window itself, known it Hwnd, I obtain different results as to Spy++ (that are ALWAYS the same results also if I shift the Main window... so I think that are relative data and not absolute data... but they are wrong )

One example:
Spy++ : (620, 473)-(792, 505)
GetWindowPlacement: (615, 450)-(787, 482)
same dimensions... but different pos... and the right pos is the Spy++ pos.

View 2 Replies

Changing Child Forms Control Box Position?

Apr 6, 2009

Well I'm not sure how to describe it so i uploaded an image that has 2 different control box positions.

[URL]

The one on top is set up as Render Mode=System while the other image is set up as Render Mode= ManagerRenderMode

Both applications were developed in VB using VS2005.

Each one has its MDI container and their MainMenuStrip set up..

What property/reason would be causing this? I just created a test program simulating the same case (MDI container with child forms) and everytime i maximized the control boxes appear in the correct position.

View 2 Replies

Set Child Form Start Up Position In Program?

Feb 21, 2009

How to set child form start position in vb.net that will be work in different screen resolutions

View 1 Replies

Set MDI Child Form To Start In Specific Position? (Or Dock In Panel)

Dec 6, 2009

How can I make my MDI child form to load in a specific position in the parent form? Or preferably, how can I make the child form Dock Inside a Panel in the parent form?

View 4 Replies

Use LINQ Add CHILD VALUE Always 1?

Jul 19, 2011

Use LINQ add CHILD VALUE always 1?I have the Tables [code]...

View 1 Replies

MDI Form Size - Child Form Doesn't Appears In Maximized State

Mar 15, 2012

I am developing a application where I have 1 parent from (windowstate of Parent from is set to Maximized) and 2 child forms. In my Parent form I have a menustrip with following code to activate child -

[Code]...

View 1 Replies

LINQ To XML And Child Objects?

Nov 20, 2009

I am creating a tool that interfaces with an API for a CD/DVD burner. I have created several custom classes that will hold the information for the disk sets (which consist of a data path and a label file among other information. The DiskSet class has a list of Include objects. My proposed XML output would be something similar to the following:

<DiskSets>
<DiskSet>
<Name>MySet 1</Name>

[code].....

I am attempting to traverse the Includes collection (I have tried List and Binding List as I am also using this in a pair of datagridview controls) and it keeps returning Expression of type 'Object is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider." How can I use LINQ to pull a list of the Include objects under each DiskSet object for transformation into XML? I am hoping to keep this restricted to this one block of code if possible.

View 7 Replies

Connect Table Like America And Child Table Like State?

May 3, 2010

how to connect my table like america and child table like State i want to add sub node or childto th tree view?

View 11 Replies

Add Child Elements To Existing Xml - Linq?

Aug 17, 2009

I'm having trouble adding child elements to the below
<securities>
<security id="040104JC6">

[code]....

View 2 Replies

Xpath - LINQ To XML Sum Child Nodes In .NET?

Nov 1, 2011

I have the following XML from Amazon's Marketplace API. I need to sum all the values of Item/ItemPrice/Component[type='Principal']/Amount for all Items to compute an order total. Is this possible to do using LINQ to XML in VB.NET?

<?xml version="1.0"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>

[code]....

View 1 Replies

.net - Use LINQ To Find MAX Or MIN Of A Field From All Child Records

Apr 20, 2011

way to write the LINQ query. The parent class is simply a student's name and a list of test score data. The child class is a single test score datum. I want to find the worst (or best) score out of all of the TestScore values and then identify the student who had the best score.

Dim query = From s In studentList _
Where s.ScoreList.Select(Function(d) d.TestScore).Min _
= studentList.SelectMany(Function(g) g.ScoreList).Select(Function(h)

[Code].....

View 3 Replies

Aggregating Parent/child Tables Using Linq To SQL?

Sep 18, 2009

I'm having a nightmare with LINQ. I've got a table of Projects, and each project has many InvoiceHeaders. The Invoice header had a field AmountNet - the value of the invoice.

I want to retrive, for arguments sake, all of the fields from Projects, with the count of invoice headers and the sum of AmountNet. I.e. list of my projects, how many invoices I've raised and the value.

Doesn't sound hard does it.... well, I've just spent the best part of two hours charging through Google and SO to find a solution.

[Code]...

View 1 Replies

C# - LINQ - Select All In Parent-child Heirarchy

Mar 12, 2012

I was wondering if there is a neat way do to this, that DOESN'T use any kind of while loop or similar, preferably that would run against Linq to Entities as a single SQL round-trip, and also against Linq To Objects. I have an entity - Forum - that has a parent-child relationship going on. That is, a Forum may (or in the case of the top level, may not) have a ParentForum, and may have many ChildForums. A Forum then contains many Posts.

What I'm after here is a way to get all the Posts from a tree of Forums - i.e. the Forum in question, and all it's children, grandchildren etc. I don't know in advance how many sub-levels the Forum in question may have. (Note - I know this example isn't necessarily a valuble use case, but the Forum object model one is one that is familar to most people, and so serves as a generic and accessible premise rather than my actual domain model.)

View 2 Replies

Creating Objects From Child Elements Using LINQ To XML

Feb 1, 2011

Is there any way to use a LINQ to XML to query an XML document like the one below to create new (anonymous or strongly typed) objects from the child elements of a descendant? Here is my XML document:

[Code]...

View 2 Replies

Linq To Entities Query With Child Objects?

Oct 13, 2011

Basically I have the follwing:Dim ctx As New AdminCoreEntities Dim roles = (From r In ctx.Roles where r.Name.StartsWith("cust") Select r) 'list of System .Linq.IQueryable(Of AdminCoreModel.Role)

[code]...

The error i get when i run this is: Unable to cast object of type System.Data.Objects.ObjectQuery`1[AdminCoreModel.Role] to type AdminCoreModel.Role

Basically I have a many to many situation and I try to get all the Quicklinks objects queried by their roles and not quite sure why EF will cast to a single AdminCoreModel.Role when i.Roles is a collections of objects.

View 1 Replies

Reading XML Element & Child Nodes Using LINQ

Aug 26, 2009

I am new in LINQ world.I need an urgent help in reading the xml elements using LINQ with specific where condition.I need to find the max air_temp for a county i.e where county name = "Boone" and hour id = "06/03/2009 09:00CDT".[code]

View 3 Replies

Cannot Access Child Value On Newtonsoft.Json.Linq.JProperty

Apr 4, 2012

I am trying to parse the json values from the following stream[code]...

I am trying to get all the children values for that property name source. Now if I use JsonTextReader I can read through everything but this is tedious and prone to errors.

View 1 Replies

Linq - Select Single Item From Child Collection?

Jan 12, 2012

I have a parent child collection objects and was wondering how to get a single item from the child collection using Linq

[Code]...

View 2 Replies

LINQ Insert Child Record Specified Cast Is Not Valid?

Mar 10, 2011

ok I have a weird issue. I created a master record in the master table and then a record in the detail table. when creating the detail record i get a Specified cast is not valid error. Now another weird thing is that once I create the master record I can't query and verify it was created. But when i got to sql management studio I can see the master record. Below is my two procedures and the table definitions. Master table primary key is INVNUM child table primary key it INVLIN_ID and the reference key is INVNUM

View 13 Replies

Linq To Xml Query Returning A List Of All Child Elements?

Mar 8, 2010

I have got an xml document which looks something like this.

<Root>
<Info>
</Info>
<Info>

[Code]...

How can i write a linqToXML query so that it returns me an IEnumerable containing each child element, in this case all five child elements of , so that i could iterate over them. The order of child elements is not definite, neither is number of times the may appear.

View 1 Replies

LINQ To XML: Suppressing Redundant Namespace Attribute In Child Nodes

Feb 25, 2010

If a node belongs to a namespace, it's children by default belong to the same namespace. So there's no need to provide an xmlns attribute on each child, which is good. However. If I create two nodes like this:

[Code]...

View 1 Replies

Order A Collection Based On A Child Property Using LINQ Or A Lambda?

Jan 26, 2012

I get the following string expression provided:"ChildObject.FullName" ...where ChildObject is an instance property on the MyObject1 type.ChildObject has a property named "FullName" and I want to sort a collection of type "MyObject1" based on this child properties "FullName" value.

I can do this all day long on properties directly on MyObject1 but I run into 2 challanges when doing it on a child instance and I can't get all the pieces working. The main 2 challanges are:

MyObject1 has a few different child property types so I can't hardcode the type for ChildObject. The string could be of any type.The sort expression is a String and not a known type.Above the value returned from the last line in the expression (if I run the code outsode the OrderBy method, does provide me the 'FullName' information I need. So the code must be close, but it still does not work.

Any ideas on how I can accomplish this? What I am trying to prevent is hardcoding a series of 'If' blocks on the child's type to then hardcode in its type to the sort or OrderBy method.

View 2 Replies

Persisting ADO Recordset As XML File?

Oct 15, 2008

I am using MS Access 2003 database and connecting to it via OLE DB for Microsoft

JetConnectionString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=c:httpDatabaseCisco_conf.mdb;" & "User ID = Admin; Password=;" objConn.Open ConnectionStringThen. I open a recordset and try to save it as XML fileIn order to persist data as XML when saving a recordset to a file, I have file in ADTG format not in XMLregardless my explicitly specifyingrs.Save "nyOrder.xml", adPersistXMLthe data saved do not seem as XML, they do seem as ADTGTG! 'т?ІПЌ# Є _юX ! Т*cцлПг Є ? @ ѕ"ИуО*е Є Dw=  яя яяI Б<Ћлm Ќц Є _юX , " m y O r d e r " m y O r d e r U рЃЂ d e s c r i p t i o nAs was suggested in http://msdn.microsoft.com/en-us/library/ms810668.aspxI tried putting provider keyword as "Provider=MSPersist;" into my connection string...but I received an error message:Microsoft OLE DB Service Components error '80040e21' Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. Please, say if it is because of MS Access DB or MS Jet provider that I can not save the recordset as XML file.

View 8 Replies

Persisting Textbox Text In VB?

Sep 7, 2011

The purpose of the program is for text to be dragged between boxes to move assets around. I've managed the drag and drop functionality but need to persist the text in the text boxes once the program is shut down so that when reopened, the last location of all moved text is still present.

I've tried the easiest to understand suggestion to get me started but when I build and publish the program it says that I do not have access to the file to save the values!!

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim txtpersist As IO.TextWriter = New IO.StreamWriter("C:UsersHPDocuments
amestore")

[code]....

View 6 Replies

.net - Persisting Sharepoint EditorPart Settings

Jul 26, 2011

Inheriting from the System.Web.UI.WebControls.WebParts.EditorPart class I have been shown that it is possible to expose a public property in your VisualWebPart that when updated through the EditorPart will be automagically persisted in sharepoint.

The problem I have run into is saving strings and integers works great but when I attempt to persist the value of a collection such as List<String> the object is not saved.

The code looks like this.

Public Class MyCustomEditorPart
Inherits EditorPart
Public Overrides Function ApplyChanges() As Boolean

[Code].....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved