Setup Custom Settings That Need To Be Persisted To Database
Mar 20, 2010
I was just wondering what is the Quickest way to set up custom settings, every software has settings that are created and saved, Example a Hotel Software has rooms, roomtypes etc that are used in combination with other things, an Accounting software has Account type, Employee Software will have Full time,Parttime, or anything else, An Employee time Clock would have departments, Tax Brackets.
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
I want to create a folder " c:imagebox " when the user runs my setup. I tried this in " Add special folder --> Custom folder " then a folder appears i renamed it to ImageBox and in default location i typed " C: " and set its property to always create but when i tested the setup on xp an vista i did not created any folder.
I have a main application and the setup project for the app in a single solution.I have custom classes to detect in sql server 2005 express is installed. if it is not I have classes to install it and create my database.Now I need to call the above classes from my setup project before it installs my actual application on a client pc.
I have a VB.Net web site and on my sign up page I am storing the ViewState in Session. I am using the following code to achieve this.[code].....
This has been working fine for months, then I started seeing the occasional 'System.NullReferenceException: Object reference not set to an instance of an object.'. The exception is raised when I try to get the value of the Text Property from the SelectedItem of a DropDownList, the problem being the DropDownList does not contain items after the page has posted back.The problem is only present when using IE (7 or 8 according to my logs, but I have only tested with 8), but not when using FireFox 3.5.Reverting to using the normal ViewState persistence mechanism caused the page to work in IE again.There are no ViewState related exceptions logged, it is like the page just 'thinks' it has no stored ViewState.
I need to install a windows service via an .msi for many tablets which is nooooo problem. The problem is, the tablets currently have the service running which was installed by installutil. So when my installer runs, regardless of Remove Previous Version is true, it stops stating the service already exists and to uninstall it from Add/Remove Programs.So I wrote a console app which preceeds the primary output as follows:
Sub Main() Try Dim filename As String = "C:Program FilesRSCProjectServiceSetupRSCProjectService.exe" 'Dim filename As String = "C:RSCProjectServiceRSCProjectServiceinDebugRSCProjectService.exe" If System.IO.File.Exists(filename) Then
I have a custom settings class which I use for Machine Wide Application Settings and save as a file. I use a custom file instead of the visual studio settings config because Int the settings to be machine scope or application scope which are normally unusable as they are readonly.I dont want the settings to be user scoped.
Imports System.Xml.Serialization Namespace My Public NotInheritable Class MySystemSettings
I have constructed a graphical user control using VS2008 and I am testing it in a solution that includes the control project and a sample form with the control and some configurable settings. In the test application I have persisted a few of the control property values in user settings.
I am using a standard template for all the property Sets in the control:
Set(ByVal Value As Integer) If my[-propertyname-] <> Value Then my[-propertyname-] = Value
[Code]....
Whenever the user changes a property in the control using a procedure in the test app, the PropertyChanged event is causing a GET (settings value) and SET (control property) for every property of the control that has been persisted by the test app, including the property for which the user just made the change.
I can understand that the settings code is listening for PropertyChanged events in order to keep the settings values updated (and I can trace the Get (control property) and Set (settings value) that is executed immediately after the property changes), but why should it also hook in a complete re-initialisation of all control properties every time the user changes one control property?
I have a Visual Basic .Net 2.0 program. I'm moving the settings from an older settings file, to an app.config program settings file. I'm trying to do this as nicely as possible.
So, I added my setting as shown in this image.
On load I do this:
If My.Settings.databaseConnectionSettings Is Nothing Then My.Settings.databaseConnectionSettings = New ArrayList() End If
[Code]....
So, the question is, how do I get that arraylist of my DatabaseConnectionSettings saved to persistent storage? I want to do this in the cleanest way possible. That is, I don't want to have to convert it to a string or save it to a separate file every-time I want to use it. I would like to be able to use the My.Settings accessor method.
I want to save a Custom DateTimePicker.Value in my Application Settings. The custom format is : dd/MM/yyyy hh:mm:ss, instead of dd/MM/yyyy The field i've created in the application settings parameters is LASTSAVE (DATE / APPLICATION)
When I try to link in the ApplicationSettings/PropertyBinding ... VALUE with my field LASTSAVE, i have an error :
The Value '01/01/0001 00:00:00' is not valid for 'Value'. 'Value' mustbe ... 'MinDate' et 'MaxDate'.
Name of the parameter : Value
I then entered the MIN and MAX date in the properties of my control DATETIMEPICKER. I have also put into the properties Value a start date like 23/11/2011 12:00:00 ;
However, when i retry to link in the ApplicationSettings/PropertyBinding ... value to LASTSAVE / I have the same error (The Value '01/01/0001 00:00:00' is not valid for 'Value'. ). I've saved all, do a process that put a value in the datetimepicker.value, but it's not saved, cause not linked.
In Visual Studio 2005 or 2008, when adding any User Controls to a Windows Form or other User Control in a Project that implements and is using a custom settings provider, a "Failed to create component" error is displayed. If all references to the custom settings provider are removed from settings.settings and that file is saved then User Controls can be added to Windows Forms and User Controls. However, if the custom settings provider is referenced again in settings.settings, then opening the designer of a Form/Control which includes a User Control results in a "One or more errors encountered while loading the designer..." error message.
I have had a very difficult time in tracking down the root cause of this issue because I assumed it had to do with my code and not the IDE. I am working within the context of a large project which uses User Controls heavily and have written a custom settings provider to persist user settings to a SQL Express database. This settings provider works properly, however if I want to open any Forms or User Controls in designer view I must first manually remove all references to my custom settings provider in setting.settings and then re-add them after the changes are done which is inconvenient to say the least. This problem is not present if the Project is in C#.
(using VB.Net 2008) I am trying to save one of my custom types to the application settings. I've read a variety of opinions on the internet about whether this possible.
When creating an app setting, none of my types appear when browsing. However, previously I needed to save off one of my datasets, and it worked simply by hand-entering it as the setting type (ie, I just typed "MyProjectName.DatasetName"). However, when I try the same trick with another custom type that isn't a dataset, I get a "type was not found" error. So I'm a little confused, can the program "find" some custom types and not others?
I would like to be able to specify exactly where the My.Settings file gets saved. It bugs me how it gets saved off in the middle of appsettings nowhere, and I would prefer it gets saved where the executable is. If anyone knows how to do this, that would be great. (P.S; I'm using VB.Net.)
once a class has been persisted on an hard disk with a strem is it neccessary to load the full class to deal with one part of it or is it possible to get just the part of the class i am interested in?
This has been driving me batty for the last while. I have an application that is passing up data to a SQL server table. Part of the data is dates. Because of settings on the SQL server the update will not accept the MM/dd/yyyy format. I have been trying for quite some time to get around this.
For some more information. Changing the update method or the server regional settings is not an option and I don't want to change my regional settings as this may not reflect the production server when this goes live.
Here is what I have tried so far
Code: Dim dateEnd As Date = Date.MinValue Dim dateStart As Date = Date.MinValue If IsDate(Me.txtPostEnd.Text) Then
[Code]....
It works fine if the day is 12 or below because it still thinks that is the month. Is there a way to force the code to recogize that I want to use dd/MM/yyyy format or even dd/MMM/yyyy format?
This has to be done at thhe vb code side as the update to the SQL server is completed via a custom framework so I can't customize the SQL code to insert the data using a CONVERT
Is it possible to create a custom start menu shortcut link?
The only possibilities I see in the setup project are shortcuts to folders or primary output.
Update:
What I ended up doing is creating a custom action on commit that dynamically creates the link using Windows Scripting Host. Then on uninstall, removing the link.
So I've been working with DotNET for a few years now; long enough to establish solid preferences for one available element over another, one available logic over another, and then to develop preferences for aspects of elements and logics.
The one that conflicts me the most is the stock Settings construct. It's a great idea - I mean everybody needs basic data persistence that isn't worthy of databasing, right? It's implemented in a way that anybody - and I mean anybody from flat beginner to highly advanced - can benefit from it. It does some heinously stupid stuff, though; for example, it angers me (and I mean full-on, where's my crowbar-OK-now where's the silly @#*! who came up with the idea anger) that the only way to save it is the way that's hardcoded in. The .SAVE method takes no parameters, there's absolutely zero exposure for the save-path to provide a more deliberate location, so the only place any settings ever get saved is in a ridiculously long (and literally arbitrarily designated) user-profile-based path.
So what happens if/when a user is ready to upgrade their OS (or just reformat and reinstall their OS, which the kinds of people who end up on my client list are prone to do just as part of quarterly maintenance), and they want to save their personal application settings to load in the next time around? They either have to hunt out that moronically obfuscatory save location or I have to write special (and I mean riding the short-short-short bus special) code which is more or less a whole new settings class identical to the settings classes implemented in the application to begin with, just to allow them to export their settings to a known location for transfer.
And what happens if a specific setting needs special treatment beyond the basic 'changing' and 'changed' events provided by the stock class? Since any change to the Settings Designer rewrites the whole code-behind property declarations, I can't do it in that code file; I either have to extend the Settings class or get back on the short-short-short bus and write that special 'mirror-class' again.
I'm not much for just general whining though, so some time back I wrote my own serializable classes (designed for specific data persistence, like generic/universal application settings and then also MySQL server connections/credentials and then also form properties and then also application-specific settings) along with shared save and load methods which give me more control over where settings get saved. These classes have evolved over the last year or so until they're actually pretty awesome (even if that's just my opinion)... I've even implemented full on-disk and in-memory encryption functions for applications that need different privilege levels, to prevent any tampering at any time.
And then a multi-user application project comes along and suddenly each individual settings class needs multi-user support based on the Windows user logged in, and suddenly the stock Settings class is the best option again even though it's still the worst possible option in settings persistence.
So what I want to know from this discussion is this:
How do YOU handle application and user-settings persistence? Is there something really key that I've been missing all this time that makes the stock Settings class more than absolutely worthless (which has been my opinion since about the first time I ever had to work with it)?It never hurts to try. In a worst case scenario, you'll learn from it.
I have a custom control that as a custom property. The property has several preset values to chose from a drop down. The control can be added to a form. The property can be viewed and set in the properties box in the IDE. It all works fine.
Here's the problem: I can create new versions and recompile the control and/or the application without the properties preset value being lost as long as I do it in Debug mode. However, once I try to recompile in Release mode the custom property values predefined setting is lost. I first thought it was something with going from debug mode to release mode. But it seems to be ANY time I recompile in Release mode the custom property values are lost. Is this a quirk in VS that needs a configuration setting, etc. to get around it?
im making a setup project with my windows application. i have pack it but the problem is my database. how do i set there new targets once i added the mdb file. i know thats the problem but i really dont know how to reconfigure
another thing, when its already pack and when i try to run the msi, the interface has an error on the picture above. and whats the bootstraper for? why is it that clicking the bootstraper is an error.
also if my target machine doesnt have vb.net and ms access, would my project be still running in there? this is my first time in making setup projects.. im using vb.net 2k3.
I trained myself to program beginning in 1980 with the Basic language for Radio Shack's TRS-80 Model III.Later learned to program macros in Lotus 1-2-3, then taught myself DBase, then started Visual Basic.I've trained myself on Visual Basic up to VB 6.0.Now, as I understand it, Windows 7 and beyond will not support using VB 6.0. I have programmed many pieces of software we use in our offices.My software is Access Database intensive. I put the database on the server and we can connect from our various computers to the databases and work on the data as necessary.I've never gotten into Server/Client types of organization because I don't understand the server model and how to do that...For the sample databases one needs a server application running and I don't have one (Our server only has a standard operating system on it).
Now I was looking at Visual Basic 2010 and am totally lost.In VB 6.0 samples, I could put a break point (debug) and stop the program and examine what it is doing.now I don't even know where to put a break point..When I put one in the samples, the sample application loads and does not hit the break point...Is there anywhere I can learn how to move up to Visual Basic 2010?I don't want to have to quit my job and go back to school but it seems soooo different from VB 6.0.Just trying to figure out 'datasets' is a chore and to see how they work in the samples, I have to set up some form of database somewhere and it does not show me how.
I have written many programs and never really needed a database before. Just never came up. I am a self learned programmer. I have experience in using php and database on websites etc. I am currently writing a program in VB 2010 and need some assistance in using a database.simplest way to setup and use a database in VB. I would believe that it's better then saving "clients/data" to a file. . The software is being created only to be used on one computer and not over a network etc.
I am using VB 2008 Express. When I publish my project, all files show up properly in the publish directory. When I go to setup.exe it installs with no errors. When I go to launch the program it says it is missing the database. Sure enough the database that is suppose to go along with the install does not get copied over. If I manually copy the file to the install directory and remove the .deploy from the name the program works like it should.[code]...
I have been Google-ing for four days now and still i can find no solution to my problem:(and my brain hurts) i recently made a windows application that pulls data from a mySQL Database and populates my form but when i was told to use excel instead of MySQL thats when the problems started. while setting up vb to connect to MySQL i found a few articles that explained in good enough detail how to set up vb before ever doing any coding
ie.( boot vb, start windows form project, click project/add reference, click on the COM tab and add the MySQL reference then click ok. next click data/Add new data source, chose database click next, click new connection, choose MySQL data source click continue, enter database info(server, user, password, port) click ok. then start coding connection strings and commands ( which i have no problem with)
My problem i can find all sorts of code to work with excel but i feel i need to go through the same environment set up as with MySQL but i cant figure out how to set it up i only need to read data from excel file to populate my form data ie.( text boxes, labels, datagridview, Ect...) does anyone know how to set up the development environment to facilitate my use of excel. or does anyone know of a better way to store and retrieve my data maybe a vb local database ( does that travel with the .exe easily?)
I'd followed Beth's video which nicely explains how to setup a "connector" to an existing database. Also, I've updated a method to retrieve information from one of the tables.Now, I need to retrieve information from the table, but I don't succeed to find the "method" to do so (I don't get to the situation that "Fill" or "GetData" are recognized methods). Could anyone send me references through which I could easily understand. how this needs to be done?