Persisting An Array Of Data Using A Custom Control

Oct 12, 2011

Does anybody know how to persist (save and recall) a structure array when using a custom control? I don't want this data to show up in the properties window but it needs to be available "behind the scenes".

Right now, I'm writing the information to a file but this causes portability problems and may trigger the UAC.

[code]...

How can I persist this without writing to a file? Should I save it to the registry?

View 3 Replies


ADVERTISEMENT

Asp.net - Persisting GridView Data Across PostBacks?

Apr 4, 2011

Alright, so here's my basic ASP.NET page setup: I've got a page with a GridView that has ContentTemplates in it. You can add a row and edit/remove rows at any time. There's a "New" button that creates a new row.

All of this data is bound to custom data objects. So if I have a GridView of "People" and each row has "FirstName", "LastName", and "Gender" (with TextBox and DropDown controls), I then have a "Person" object which has public properties for "FirstName", "LastName", etc. I have the binding set up correctly, and I can push data into the GridView from the object, and I persist the object with the Session variable. My page lifetime structure looks something like this:

Page_Load: Loads the List(Of Person) from Session()
Any events fire, and modify the List(Of Person).

After any event, the List(Of Person) gets saved back into Session(), and is then DataBound to the GridView (and any subsequent fields are also DataBound, such as the DropDownList.

My question is: Whenever I fill in rows in the GridView, and then add a new row (there is no database saving going on whatsoever), my fields clear out and don't persist across PostBacks. So, how can I persist my custom data objects with databinding across postbacks?

View 2 Replies

Create Custom 2 Dimensional Array Data Structure?

Feb 20, 2010

I want to create a user defined data structure, which will be a 2 dimensional array such that each individual square of this 2-dimensional array will also store the score and the grades. ( Iam using VB.NET)
More details: for example: There is an 2 dimensional array with 3 columns and 2 rows, I want to fill each of the

[Code]...

View 2 Replies

Develop A Custom WinForms Data Source Control?

Nov 6, 2009

How can I develop a custom data source control for WinForms ? This example is just for ASP.NET. VS version: VS 2008

View 7 Replies

DataGridView / Data Source (Adding New Row Programmatically) + Custom Control 'setting?

Jul 30, 2010

1. I have a DataGridView box, that is connected to a MySQL database via the 'Data Source'. I am trying to do the datagridview1.rows.add("info here"), however i receive an error i cannot do this programmatically. I DO know the code to post to MySQL via the "insert into" la la la.However, I was curious if I can do this via the datagridview a bit..easier/simpler, such as a "datagridview1.rows.add(stuff)" sorta thing.

2. I am attempting to make a custom control, and as with ANY control, they have their.. settings. Example, a textbox, or label, has so you can set the Text. and color, etc.Others, have it (such as datagridview) have the little icon on the control itself, where you click it, and it opens a small window with settings.

View 8 Replies

VS 2010 : Copy This Array To A Temp Array So That The Temp Array Has All The Same Values As The Original Custom Array?

Jun 19, 2011

I have an array of people stored in a custom structure array... how can i copy this array to a temp array so that the temp array has all the same values as the original custom array?

View 4 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

Adding NumericUpDown Control Data To An Array

Apr 25, 2011

What syntax do you use to add decimal data held in a NumericUpDown control, and add it to a one dimensional array? Is there a keyword to sum all the items in the array into one number(For averaging purposes)?

Dim heightarray As String()
ReDim Preserve heightarray(0 To UBound(heightarray) + 1)
heightarray(UBound(heightarray)) = heightNumericUpDown.Value

View 14 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

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

App. To Create An Control Array At Runtime That Will Consist Of Up To 50 Data Bound Labels

Mar 13, 2010

I need my app. to Create an Control Array at runtime that will consist of up to 50 Data Bound Labels. The app. will first be checking the 1st database field (Ing1) to see if there is data, if so then only create the 1st Data Bound Label (lblIng1) and then check the next field and so on.

The problem is that VB 2008 dos not seem to support Control Arrays. There must be another way to work around this.

View 12 Replies

Combo Box Control - Button Is Pressed, The Current Data Is Stored Into The Array?

May 28, 2009

I am working on an inventory managment project for a lumber mill. I am currently writing a piece of software to be used on the sorting section of the mill. The problem I am having is when a stick of lumber needs to be cut down in lengt. My current setup has a combo box that is populated with lengths of lumber that we might have (2' - 60'), a "Add" button and a data control (homemade solution with lots of labels, and panels).

The user will scan a tag into the system, and the system pulls up the info from the db. If the piece need to be cut, the user will select the length of the cut, and click the add button. The system will then populate the first line of the data control with the info from the cut (previous piece info, and new length). It also populates a pieceObject struct. This happens for any additional cut that might happen.

The problem I am having is that everytime I press the "Add" button, the length variable will update every length in the piece array.

Here is a section of the code I am dealing with.

piece is a lumberPiece, and pieceAry is a array of 15 lumberPieces

Each time the add button is pressed, the current data is stored into the array, and then the pieceNum is incremented.

[code]...

View 4 Replies

VS 2010 Custom Type Array / List With Adding Items And Specifying Custom Type Variable

Jun 21, 2011

I recently downloaded VB 2010 Express so i am quite new to the language, but i have worked with dark basic, which seems to b very similar.Anyway, my problem is that i cannot seem to correctly set out my array of a custom type/class. i am trying to create two arrays, one of available entities and another of selected entities of which the user selects the entities to be dealt with in irrelevant ways. i have creates a button (called test) which adds some entities to the available list and all the entities come back the same value but they shouldnt be as you'll c in the code. i have run the step into command a found that "available.item(#).Name = " will change all of the entity's names.As of current i am working with lists as the array kept asking for a 'new' statement but i couldnt figure out where to put it.[code]

View 7 Replies

Changing Text Of Custom Control Based On Text Of Another Custom Control

Jan 11, 2010

I am using custom textboxes and I need to be able to set the Text on txb1 based on the Text of txb2. I have simplied my code to the following:

Public Class customtextbox
Inherits TextBox
Public Event ControlReset()

[Code]....

So, when txb1 looses focus, if its Text is "fried", then it sets off txb2's ProcessAlert function. I had tried to change the value of txb2 Text in ProcessAlert function, but didnt work, so I tried to get it to raise an event instead, which then tries to set the Text property. However I still cant set txb2's Text property. The Text property seems to be set for the duration of the "life" of the Event handler. When I step through the forms controls within the Event handler, the changed Text value is there, but not outside of the Event handler.

View 2 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

Chart Control - Creating Graphs Using Crunched Data Stored In Array List

May 7, 2010

Recently I have learned visual basic 2008 express edition and developed programs for data crunching and analysis. The VB 2008 express edition has microsoft visual studio 2008 v. 9.0.30729.1 SP and .NET Framework version 3.5 SP1. Now I want to create x-Y (date-Y value) graphs using the crunched data stored in an array list simulating a data base access. I download and installed the "Microsoft Chart Control for .NET Framework " and try to learn to use it within the VB 2008 express edition using the tutorial. It seems that the chart control did not get installed?

1. Do I need at VB 2008 professional to allow using the chart control?
2. Why after installing chart control, there is no change on the items under the NET components within the Toolbox>ChooseItem>.
3. How do I get to use the chart control under VB 2008 express edition.
4. Any code available to generate versatile graphics without using the chart control? Because the chart control has tons of classes already it seems the best is to just use the existing and downloadable chart control?

View 8 Replies

C# - Persisting Date Selections When Visible Month Changes

Feb 21, 2011

Dim List As New List(Of DateTime)

Then in my button click event:

If InputBookinglength.SelectedValue.ToString = "2" Then
Dim paramstring As New StringBuilder
If Session("SelectedDates") IsNot Nothing Then

[Code]....

This code works fine when selecting multiple days in one month. But when you switch to display a different month, the previous months selections are lost. how to persist the selections when the visible month changes.

View 1 Replies

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

Handles Button.click Event From Custom Control Inside Other Control?

Jul 29, 2009

I've created my own ascx control with button inside it. Now I'm using this control inside other control. (In my case it is a webpart). What I would like to do is program button.click logic from my custom control inside webpart

View 4 Replies

Persisting A Collection, That References An Internal Property, At Design Time In Winforms, .net?

Mar 11, 2010

(I've answered the question below with a hack. I'm fairly confident in it unless MS change the way that codedom serializers the designer code.)ETA2:I've worked out what is going on. I wondered why sometimes it would work and not others. It boils down to the name that I give to the internal property and the collection.If I rename the property 'Annoyance' to 'WTF', it will serialize correctly because 'WTF' is, alphabetically, after the name of the collection - 'InternalAnger'.It looks like the serializer is creating instances of objects alphabetically and needs my internal property to be created by the time it comes to create the collection.I can fix this with a rename, but that's a hack and I fear that writing a custom serializer is a big job - which I've never done before.ETA: Jesus, I'm sick of this. This problem was specifically about persisting an interface collection but now on further testing it doesn't work for a normal collection. Here's some even simpler code:

Public Class Anger
End Class
Public Class MyButton

[code].....

View 4 Replies

Create A Custom Class That Has Inside An Array Of Another Custom Class?

Jan 31, 2011

I want to create a custom class that has inside an array of another custom class (see my code below) but when the programm runs is crashes. Why? What is the right expression???? Plz help I'm a newbie in VB.net.....

Public Class ctrarray
Public nameclass As String
Public ctrlindex(glvar_spaces) As ctrlindexclass
End Class

[code]....

View 6 Replies

Can A Custom Control NEW Sub Be The Only One That Executes When Inheriting From An Existing Control

Jul 17, 2011

Can a custom control NEW Sub be the only one that executes when Inheriting from an existing control please?I am Inheriting from TabControl and I do not want the base New Sub called, is this possible?In other words, I do not want TabPage1 and TabPage2 to be added.A Form has an Activated Sub which runs once a Form is activated.It is a pity that Microsoft have not got such a method in the baseControl Class otherwise I could have used it within a custom TabControl.

Public Class Form1
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
End Sub

[code]....

View 8 Replies

Embed A SilverLight Control In ASP.NET Control (user Or Custom)?

Apr 29, 2010

We have a ASP.NET web application written in VB.NET where we build content programmatically during the Init event.We make extensive use of user controls, building them on the fly, and I now want to start including SilverLight content.Is there an easy way of embedding a SilverLight application in a control, and then instantiating the whole thing in code, in the same way as you'd programmatically add ordinary ASP.NET controls to a page?The SilverLight component itself works fine when added to a page using the <object> tag but I really want to be able to reuse it elsewhere in code.Since I'm expecting use of SilverLight to increase in our application, and the asp:Silverlight control seems now to be deprecated, I'm looking for an alternative way of wrapping the content.

View 1 Replies

Get Custom Properties For A Custom Control Into The Visual Studio Properties List?

Nov 25, 2009

What I've done is create a User Control Library (Project) and I've added a single User Control to that project. The control contains a single FlowLayoutPanel, and I created a Property on the control itself to pass the FlowDirection from the Control to its FlowLayoutPanel child.

Build, reference, component appears in the Toolbox and everything works fine, but the property on the control does not appear in the Properties window when I go to edit it at design time.

View 6 Replies

Know About User Control And Custom Control?

Jan 9, 2012

I want to understand N-tier architecture like when to use and so on.Also I would like to know about user control and custom control.

View 4 Replies

.net - VB Datagrid + Array With Custom Class?

May 14, 2012

I have created a class "student" and made an array which contains students.I would not only like to display the array in a datagridview, but the array should also be updated if the user makes changes to one of the students in the datagridview.

I succeeded in showing the array in the dgv: one way is using datasource prop, the other is doing is diagrammatically. However, i can't find out how to let the user edit the array by editing the dgv.

View 1 Replies

Custom Class As An Array Of Properties?

Sep 30, 2009

I'm moving my first steps in the VB.NET world (I come from VB6) and I'm stuck with the creation of a particular class.

Let's say we have a bus that always has 101 places. I'm trying to create a class containing the map of the bus, along with methods to graphically represent it.

My "Bus" class will have a couple of properties ("BusColor", "BusModel") related to the whole bus. Then it should have a property called "Places" whose type is a custom class thet represents every single place, along with, for example, the passenger name or the place number. This property should of course be an array.

This is my code so far (simplified):

Public Class BusMap
Private Const MAX_PLACES As Integer = 101
Private _BusModel As String = ""

[Code]....

but I wonder if there is a more standard way of doing this.

My second question is: how can I modify my class to be able to iterate its Places property with the "for each" statement? A quick search on the web showed up that I should implement the IEnumerable interface, but I'm still not enough confident with the concept of Interfaces.

View 6 Replies

Dynamic Array Of Custom Class

Jun 16, 2009

I've been programming in VB.net for a while off and on, but never really had a need to use custom classes till now.I built a function in a module to populate a class, The class how ever is supposed to refer to one instance.I need to create an array of this class but the amount of instances needed is not always known.Works fine till the class goes to populate the class array.[code]It's probably something simple, I've just starred at it to long. Keep gettitng "Object reference not set to an instance of an object."

View 1 Replies

Specify An Inline Array To Custom Attribute?

Oct 4, 2010

I would like to know if there's any way to specify an inline array (lets say of strings) to custom attribute on a property in vb.net.

I have the following example that doesn't compile in vb.net (.net 1.1):

Attributes.ManyToOne(New String() {"a", "b", "c"})> _
Public Property PaymentTerms() As PaymentTerms

[Code]....

I get compiler error when I feed the array to the custom attribute in vb.net. I have no problem in C#, just vb.net. What is the correct syntax in this silly language?

View 1 Replies







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