C# - Custom XML Serialization, Write Custom Root Element?

Mar 15, 2010

I'm using custom serialization and when the xml is generated it's putting the class name as the root element

Example:

<MyClassName>
<MyIntendedRootNode>
<ObjectType>

[code]....

I'm invoking the serialization by calling xmlserializer.Serialize(writer,Me) so I'm sure that has something to do with it.I've tried putting XMLRoot onto the class, but I think as vb is compiling this partial class with its aspx page, it's either overwriting this property or ignoring it entirely.I'd like to just tell it to either throw away everything it has and use a different root element.

View 5 Replies


ADVERTISEMENT

VS 2008 Binary Serialization And Custom Collections

Aug 26, 2011

I used the ideas from this post to create a custom collection of my custom class, so that I would be able to easily sort my collection. My project uses binary serialization to save everything (well the important stuff anyway) to a file. The problem is that my custom collection now breaks the serialization.I can't seem to figure out how to get the custom collection to serialize![code]

View 10 Replies

Custom Serialization And Circular References, Is There A Clean Solution?

Aug 3, 2010

I'm implementing some custom serialization (to byte array), and have run into a problem handling circular references.Example:

Class A
public MyBs as new List(of B)
End class

Class B
public MyParent as A
public MiscInt1 as integer[code]....

If I know that an instance of B will only ever be serialized through the serialization of an instance of A, then I can handle the setup of the MyParent reference from the instance of A and not even record that information inside the byte buffer for the instance of B.This doesn't feel quite right, but it might be the best solution.

View 1 Replies

Serialization Fails Because A Form Is Handling A Custom Object's Event

Aug 12, 2009

My application's binary serialization was working well up to today (this is not a released app yet - still in development). I have a "Project" class that is the top-level class of a hierarchy of other classes related to its function. And before you think it, yes, all of those classes are marked as serializable. Infact, they all were being serialized before today.

I have one event on the Project class that assists in informing when the project's save status has changed (i.e. new, modified, saved). This event was added today along with some events on the other classes that filter up to the Project class (the project needs to be told when its objects have been modified). I unfortunately added all of this at the same time so I can't provide any incremental details as to when it stopped working, but when I try to save the project through my binary formatter it tells me that my main form is not marked as serializable. Well, yeah... of course it isn't! it shouldn't need to be because there is no member of my classes that even mentions the form. But for some reason handling the Project's event on the form triggers this error.

Serializing the form is not a solution. Neither is not being able to handle my Project events. If I comment out the handler it works fine -- and I don't even have to remove the WithEvents keyword on my form's Project variable. Now that I write that I'm speculating that it may have to do with the event being raised as a result of the serialization (occurs when the save button is clicked).

View 7 Replies

Add A Custom Web.config Attribute To A Pre-existing Element?

Jan 4, 2012

I have created Custom .NET controls, and I'd like to know if it's possible, how to add a custom attribute in the web.config when you add the reference to the control.

Currently it is:
<controls>
<add tagPrefix="FOO" src="~/Controls/FooControl.ascx" tagName="Bar" />

[code].....

View 2 Replies

Set Up A Custom App Configuration Element Collection Section?

Aug 24, 2010

I would like to set up a custom app configuration element collection section like this

<logSectionGroup>
<logSection name="Testttt">
<properties name ="Pride">[code]....

Properties would be the configuration element, and log section would be the configuration element collection.The problem is, I've only seen where you can have multiple instances of a single element instead of multiple elements.

<Section name="Section1">
<Section name="Section1">
<SubSection name="SubSection1">[code]....

View 2 Replies

Grab Attributes Of Articles Element Under Custom Section In Web.config File

Sep 2, 2009

I am building the 'TheBeerHouse' project in vb.net (the book is written in C#). Once I understand the concepts, I can usually convert it to vb. However, there are a few areas that give my some problems (which I will address individually). The first issue I have is the C# 'base' to VB 'MyBase'. [code] My understanding of this conversion is that I need to grab the attributes of the <articles> element under the <theBeerHouse> custom section in the web.config file.This code does not compile and the get the following error: 'MyBase' must be followed by '.' and an identifier.

View 4 Replies

Create A Custom Messagebox, With Varying Number Of Buttons With Custom .Text Descriptions?

Feb 6, 2009

This is what I would like to achieve:To create a custom messagebox, with varying number of buttons with custom .Text descriptions, and other features. I intended to have a property array that would be redim-ed and have values (.Text values) set by the calling class:

[code]...

View 7 Replies

Apply Percentage Format To Custom Cell In Custom Column In DataGridView?

Jun 25, 2009

I came across this great article on creating a custom datagridview column which creates a graph-like effect in the cells of a custom datagridview column:[URL]..Does anyone know how you would edit this to format the number in the cell as a percentage? And does anyone know how you would set this up to take 0 values which do not create any graph effects at all.I have been trying to do this but keep getting errors.

View 1 Replies

Avoid Closing Of A Custom Combo Box Popup Window In A Custom Datagrid?

Jan 31, 2012

I was trying to block the closing of a custom combo box popup window in my custom DataGrid. The popup window comes by pressing F4 or ALT+DOWN keys in my datagrid which is getting closed if I press the down arrow for the first time, after showing the first value in the combo box as selected. Next time onwards, if I press the F4 key and down arrow, I can move to any item in the popup window and select the item using keyboard and in that case, the popup window is not getting closed till I press the ENTER key or selection using the Mouse. Is there any specific reason for this behaviour or something is missing in my code part? [code]...

View 1 Replies

Avoid The Closing Of A Custom Combo Box Popup Window In A Custom Datagrid?

Sep 2, 2010

I was trying to block the closing of a custom combo box popup window in my custom DataGrid. The popup window comes by pressing F4 or ALT+DOWN keys which is getting closed if I press the down arrow for the first time after showing the first value in the combo box as selected. Next time onwards, if I press the F4 key and down arrow, I can move to any item in the popup window and select the item using keyboard and in that case, the popup window is not getting closed till I press the ENTER key or selection using the Mouse.

View 13 Replies

Specify A Custom Icon For Display In The Toolbox Window When Create Own Custom Control?

Dec 29, 2011

how to specify a custom icon for display in the toolbox window when you create your own custom control? Something other than the dreaded "gearbox" icon.

View 2 Replies

Make Stand Alone, Custom Web Browser (with Custom Errors, Or Generic)

Dec 13, 2011

Cookies to be stored in folder and on close delete the cookies The ability to watch youtube vids, view images, and play js/flash games good security, no ads?

View 6 Replies

How To Read / Write Custom Config File

Jan 6, 2011

Environment: .Net 3.5 VB.net (C#ok too) I wrote a multi-project WinForms app that needs to load a couple dozen variables from a client section of a config file based on user's selection of client. Also some program variables need to be loaded as well. So far so good, I put them in an app.config file.In the appsettings section I put the main program variables. e.g.

[Code]....

View 3 Replies

Write Custom HTML Document To File?

May 2, 2011

What is the best way to write data from a hierarchical set of objects to a file? The highest order parent has 1000's of children all with children (DOM style). Trying to traverse the tree and creating one big string which is then written to a file is throwing an out-of-memory exception while creating the string.

Details I've created a set of classes that make up an HTML document. There was control that I needed that the pre-packaged HtmlElement and HtmlDocument didn't give. The Document Object Model is maintained throughout, with some similar methods and properties and such. I'm using the custom classes to create a very large HTML document. When I say large, I mean on the order of over 2000 printed pages. It's doubtful that they will all be printed, but some will be.

My base HTMLElement object, from which all other objects are derived, contains an OuterHTML property which, as expected, gets the full HTML of the calling object and the HTML of all child elements. After the code which generates the report runs, I have my HTMLDocument object containing the entire report which needs to be written to a file. Here is where I keep running into problems.

If I call OuterHTML on the HTMLDocument object, I get an out of memory exception.
Other reports have saved fine, but this is by far the largest report I've thrown at my HTMLElement object. My assumption is that the property call is generating too much text.

I am basically just creating a new .HTML file, opening it for reading, and writing in all of the text. Like:

File.WriteAllText(FileName, HtmlDoc.OuterHTML)

View 1 Replies

Create A Custom File Association ( A Custom Extension ) In VB?

Dec 19, 2010

know how to create a custom file association ( a custom extension ) in VB .Net and how to open it on the application

View 1 Replies

Custom Principal & Identity Missing Custom Functions

Jun 21, 2010

I have a Custom Principal class that Implements System.Security.Principal.IPrincipal and a Custom Identity class that Implements System.Security.Principal.IIdentity. So when a user successfully login to my windows form application, I set My.User.CurrentPrincipal = CustomPrincipal, which worked great until I started adding custom functions to my Principal and Identity classes.

[Code]...

View 1 Replies

Not Getting Redirection To Custom Error Page Using Custom Errors?

Mar 24, 2010

Here's my Application_OnError event sink in global.asax.vb:
Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs)
Dim innerMostException As Exception = getInnerMostException(Me.Context.Error)

[code].....

View 1 Replies

Cannot Consistently And Reliably Write To A Custom Event Log From DotNet

Oct 13, 2010

Cannot Consistently and Reliably Write to a Custom Event Log from DotNet

View 4 Replies

VS 2005 Write Data In Custom File Format?

Apr 28, 2010

I want to write the data to a file which in an format that is only understandable by my program, and if any one opens it in notepad must not be able to read(understand) it.

View 8 Replies

Asp.net Mvc - Custom AuthorizeAttribute + Custom SiteMapProvider Related?

Jan 12, 2010

I have a custom SiteMapProvider (populated from database) and a custom AuthorizeAttribute (validates current users roles + requested page against Role_Page database) for controller classes.I have to implement the function SiteMapProvider.IsAccessibleToUser(context, node). I also have to implement AuthorizeAttribute.AuthorizeCore(context).How are these two functions related? Isn't there some way to 'attribute' the SiteMapProvider?

Some code:

edit: Might this be a solution (inside AuthorizeCore())? context however is HttpContextBase, and IsAccessibleToUser() only takes HttpContext as parameter.If Not SiteMap.Provider.IsAccessibleToUser(context, SiteMap.CurrentNode) Then

current code:

Public Class CustomValidateAuthorization : Inherits AuthorizeAttribute
Public Sub New()
End Sub

[code]....

View 1 Replies

Custom Control With Custom Collection Property?

Jul 11, 2011

I have an ASPX Custom Control which is supposed to load it's properties into an internal collection (defined with PersistenceMode.InnerProperty). Here's the ASPX

<cc:CustomControl runat="server">
<Queries>
<cc:QueryTypeOne ... />

[code]...

View 1 Replies

Have Custom Background And Custom Hover Images?

Sep 10, 2010

how can i get custom menu bar like this (office 2010) example:I need to have custom background and custom hover images. I work in Visual Basic 2010?

View 6 Replies

IDE :: Created A Custom UserControl, With A Custom Designer?

Dec 3, 2009

I have created a custom UserControl, with a custom designer, which contains a Panel which is editable. Any controls dropped onto this Panel will go off-form when an Anchor is set. This was already reported here and acknowledged as a bug:[URL].. Are there any known workarounds? Or available hotfixes for this issue?

I already implemented ISupportInitialize in my custom panel class, where i set the docking, which doesn't help. Here's the relevant code:

[Code]...

View 1 Replies

Find The Root Of A Number Such As The Square Root, Cube Root 5th Root Or Whatever

Sep 23, 2011

For those of you interestested in mathematics you can find a root of a number in two different ways. Lets say you want to find the 5th root of 27.

[Code]...

View 2 Replies

Using Write Start Element And Write End Element In VB For XML Code

Oct 2, 2009

I know I can create XML ouput in Example 1 as follows using the following code in Example 2. How do I create the same output in Example 3?[code...]

View 9 Replies

VS 2010 - Write A Custom Comparer To Make A Listbox Full Of Numbers Sort Itself

Jan 17, 2012

So...numeric sorts. Do I really need to write a custom comparer to make a listbox full of numbers sort itself like:

[Code]...

View 4 Replies

How To Merge Two XML Files Into One File With New Root Element

Feb 13, 2012

I have a pair of XML files that each have the same root element. I want to merge them into one XML file that has a new root element and which uses the former root element as child nodes.[code]I want to merge these two XML files into one XML file, and do so within a new root element, such as the following example:[code]

View 7 Replies

XPath When A Root Node And Element Have Different Name Space Attributes?

Jun 8, 2010

I got struck with a problem in VB.Net getting Xpath for an XML element as shown below:

<Parent xmlns:"http://www.sample.com">
<body>
<Child xmlns:"http://www.notsample.com">

[code]....

I need Xpath of the "element" in above XML using VB.Net NameSpace Manager For the "body" node i have done and its working but i couldnt do the same to "element":

dim bodynode as XMLNode=XML.SelectSingleNode(//ns:body,nsmngr)

where "nsmngr" is the namespacemanger created by me and "ns" is the name space of the "parent node" (which the "body" node inherits) added to the namespace manager as "ns"

View 2 Replies

Create Custom Database In Windows Application - Double Click Custom Database File?

Jul 21, 2006

With VB.net, I'm coding a simple application to get more used to the new .Net format.

I'd like to save all the information to a 'new' database file. how to create a database on the fly, once that is done i'll be able to connect to it no problem, but actually creating the file is proving difficult to work/find out.

Also, with vb.net and the newly created custom file, how can it be made to automatically open that information with the program?

Is there a method in installation to associate the file type with the new program? How can i check when the program loads if a database file has been 'double-clicked' (rather than just running from the .exe of the program) and proceed to load the data?

EDIT1 - Extra InfoThe windows application has many different fields and content etc, then i need to save that to a file that could later be loaded by 'double clicking'. I assumed the easiest way would be to create a mini-database for each unique file

View 3 Replies







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