SQLite much more simplistic data types compared to SQL. The datatype limitations can be cumbersome especially if you add time durations, dates etc as SQLite has very few built-in functions for these. The up side however is that SQLite provides an easy way to make your own built in functions for adding things like time durations (the sqlite3_create_function library function). You use that […]
All posts by
Create New Database
Create Database File Example using System.IO; using System.Windows.Forms; namespace MyProjectNamespace { class DatabaseSqlite { const string SQLITE_DATABASE_FILE_PASSWORD = "add_my_password_here"; //Set as "" for no password //************************************* //************************************* //********** CREATE DATABASE ********** //************************************* //************************************* bool CreateDatabase () { String FilePath; System.Data.SQLite.SQLiteConnection Connection1 = null; try { //—– CHECK DIRECTORY EXISTS —– if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + […]
Using Null
Determining if a handle is a null pointer if (MyString == null) MyString = "";
Constants
You have to use constants within a class. So like this: You’d need to put it in a class somewhere, and the usage would be ClassName.MY_NUMBER Number Defines String Defines Array Defines Const can’t be used because it can only be applied to a field whose value is known at compile-time and arrays are not […]
.SQLite General
See our C++ page here
Adding SQLite to a project
Get the latest set of files from system.data.sqlite.org Binary packages are intended to be used for development and deployment of their applications onto customer machines. Ensure you select the correct version for the .NET Framework version and Windows 32/64bit version your applicaiton targets. Select the version without 'mixed-mode assembly' bundle. (Setup packages are intended for developer machines if […]
.Useful Things
Exiting The Application (i.e. File > Exit menu item) Application.Exit(); Note that the Form..::.Closed and Form..::.Closing events are not raised when the Application..::.Exit method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the Form..::.Close method for each open form individually […]
Menu
The main Menu is called the MenuStrip Menu’s that pop up within the context of some control, for instance when you right click, use the ContextMenuStrip. Creating a MenuStrip Drag the menu tool onto the top of the form You can edit the menu contents using the properties > collections (recomended for complex menu’s), or […]
Button Images
Creating Images PNG with transparancy DPI = 72 If using a normal 3D button the button size will need to be the image resolution + 6 Buttons With No Border (Just image but no mouse over or click effect) Button properties Text = [blank] Image = Set Image FlatStyle = Flat FlatAppearance > BorderColor = Set to match background […]
Create New Form
Creating The Form Project > Add Windows Form. Name it using 'frm' at the start (our convention) Set the 'Form Border Style' Set 'MaximiseBox' and 'MinimizeBox' properties Set StartPostion Set 'Text' Set 'icon' (or turn off ShowIcon) Nice Things To Do Add this before the constructor public partial class frmMyForm : Form { //————————– //—– PUBLIC […]