diff --git a/BooleanValue/App.config b/BooleanValue/App.config new file mode 100644 index 0000000..8324aa6 --- /dev/null +++ b/BooleanValue/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BooleanValue/CheckBoxAdv_DataBinding_Boolean.csproj b/BooleanValue/CheckBoxAdv_DataBinding_Boolean.csproj new file mode 100644 index 0000000..82d718a --- /dev/null +++ b/BooleanValue/CheckBoxAdv_DataBinding_Boolean.csproj @@ -0,0 +1,148 @@ + + + + + Debug + AnyCPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58} + WinExe + CheckBoxAdv_DataBinding_Boolean + CheckBoxAdv_DataBinding_Boolean + v4.6 + 512 + true + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + True + + + packages\Syncfusion.Grid.Base.18.1.0.59\lib\net46\Syncfusion.Grid.Base.dll + + + packages\Syncfusion.Grid.Windows.18.1.0.59\lib\net46\Syncfusion.Grid.Windows.dll + + + packages\Syncfusion.Licensing.18.1.0.59\lib\net46\Syncfusion.Licensing.dll + + + packages\Syncfusion.Shared.Base.18.1.0.59\lib\net46\Syncfusion.Shared.Base.dll + + + packages\Syncfusion.Shared.Windows.18.1.0.59\lib\net46\Syncfusion.Shared.Windows.dll + + + packages\Syncfusion.SpellChecker.Base.18.1.0.59\lib\net46\Syncfusion.SpellChecker.Base.dll + + + packages\Syncfusion.Tools.Base.18.1.0.59\lib\net46\Syncfusion.Tools.Base.dll + + + packages\Syncfusion.Tools.Windows.18.1.0.59\lib\net46\Syncfusion.Tools.Windows.dll + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + Always + + + Always + Database1.mdf + + + + + False + Microsoft .NET Framework 4.6 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/BooleanValue/CheckBoxAdv_DataBinding_Boolean.csproj.user b/BooleanValue/CheckBoxAdv_DataBinding_Boolean.csproj.user new file mode 100644 index 0000000..626fbdd --- /dev/null +++ b/BooleanValue/CheckBoxAdv_DataBinding_Boolean.csproj.user @@ -0,0 +1,13 @@ + + + + + + + + + + en-US + false + + \ No newline at end of file diff --git a/BooleanValue/CheckBoxAdv_DataBinding_Boolean.sln b/BooleanValue/CheckBoxAdv_DataBinding_Boolean.sln new file mode 100644 index 0000000..d76a105 --- /dev/null +++ b/BooleanValue/CheckBoxAdv_DataBinding_Boolean.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30225.117 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckBoxAdv_DataBinding_Boolean", "CheckBoxAdv_DataBinding_Boolean.csproj", "{78CB1CD0-3B83-4A0E-A39F-8C1363642B58}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F1E82705-F416-4603-81E3-158F318050F0} + EndGlobalSection +EndGlobal diff --git a/BooleanValue/Database1.mdf b/BooleanValue/Database1.mdf new file mode 100644 index 0000000..ae02a53 Binary files /dev/null and b/BooleanValue/Database1.mdf differ diff --git a/BooleanValue/Database1_log.ldf b/BooleanValue/Database1_log.ldf new file mode 100644 index 0000000..a2d2027 Binary files /dev/null and b/BooleanValue/Database1_log.ldf differ diff --git a/BooleanValue/Form1.Designer.cs b/BooleanValue/Form1.Designer.cs new file mode 100644 index 0000000..45f4f8d --- /dev/null +++ b/BooleanValue/Form1.Designer.cs @@ -0,0 +1,79 @@ +namespace CheckBoxAdv_DataBinding_Boolean +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.checkBoxAdv1 = new Syncfusion.Windows.Forms.Tools.CheckBoxAdv(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv1)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(12, 53); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowHeadersWidth = 51; + this.dataGridView1.RowTemplate.Height = 24; + this.dataGridView1.Size = new System.Drawing.Size(393, 311); + this.dataGridView1.TabIndex = 0; + // + // checkBoxAdv1 + // + this.checkBoxAdv1.BeforeTouchSize = new System.Drawing.Size(168, 39); + this.checkBoxAdv1.ImageCheckBoxSize = new System.Drawing.Size(16, 16); + this.checkBoxAdv1.Location = new System.Drawing.Point(517, 161); + this.checkBoxAdv1.Name = "checkBoxAdv1"; + this.checkBoxAdv1.Size = new System.Drawing.Size(168, 39); + this.checkBoxAdv1.TabIndex = 1; + this.checkBoxAdv1.Text = "checkBoxAdv1"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(712, 432); + this.Controls.Add(this.checkBoxAdv1); + this.Controls.Add(this.dataGridView1); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView1; + private Syncfusion.Windows.Forms.Tools.CheckBoxAdv checkBoxAdv1; + } +} + diff --git a/BooleanValue/Form1.cs b/BooleanValue/Form1.cs new file mode 100644 index 0000000..efd3b74 --- /dev/null +++ b/BooleanValue/Form1.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CheckBoxAdv_DataBinding_Boolean +{ + public partial class Form1 : Form + { + public static string dataBasePath = Path.GetFullPath("..\\..\\Database1.mdf"); + public string connectString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + dataBasePath + ";Integrated Security=True"; + public Form1() + { + InitializeComponent(); + + using (SqlConnection sqlConnection = new SqlConnection(connectString)) + { + sqlConnection.Open(); + + SqlDataAdapter dataAdapter = new SqlDataAdapter("SELECT * FROM [Table]", sqlConnection); + + DataTable dataTable = new DataTable("Table"); + dataAdapter.Fill(dataTable); + + dataGridView1.DataSource = dataTable; + this.checkBoxAdv1.DataBindings.Add("BoolValue", dataTable, "CheckValue"); + + } + } + } +} diff --git a/BooleanValue/Form1.resx b/BooleanValue/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BooleanValue/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BooleanValue/Program.cs b/BooleanValue/Program.cs new file mode 100644 index 0000000..2cbc43c --- /dev/null +++ b/BooleanValue/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CheckBoxAdv_DataBinding_Boolean +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/BooleanValue/Properties/AssemblyInfo.cs b/BooleanValue/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..337148b --- /dev/null +++ b/BooleanValue/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CheckBoxAdv_DataBinding_Boolean")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CheckBoxAdv_DataBinding_Boolean")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("78cb1cd0-3b83-4a0e-a39f-8c1363642b58")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/BooleanValue/Properties/Resources.Designer.cs b/BooleanValue/Properties/Resources.Designer.cs new file mode 100644 index 0000000..bff1b52 --- /dev/null +++ b/BooleanValue/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CheckBoxAdv_DataBinding_Boolean.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CheckBoxAdv_DataBinding_Boolean.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/BooleanValue/Properties/Resources.resx b/BooleanValue/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/BooleanValue/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BooleanValue/Properties/Settings.Designer.cs b/BooleanValue/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d48e71f --- /dev/null +++ b/BooleanValue/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CheckBoxAdv_DataBinding_Boolean.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/BooleanValue/Properties/Settings.settings b/BooleanValue/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/BooleanValue/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/BooleanValue/packages.config b/BooleanValue/packages.config new file mode 100644 index 0000000..ee2a480 --- /dev/null +++ b/BooleanValue/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/IntegerValue/App.config b/IntegerValue/App.config new file mode 100644 index 0000000..8324aa6 --- /dev/null +++ b/IntegerValue/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/IntegerValue/CheckBoxAdv_DataBinding_Boolean.csproj b/IntegerValue/CheckBoxAdv_DataBinding_Boolean.csproj new file mode 100644 index 0000000..59dc979 --- /dev/null +++ b/IntegerValue/CheckBoxAdv_DataBinding_Boolean.csproj @@ -0,0 +1,148 @@ + + + + + Debug + AnyCPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58} + WinExe + CheckBoxAdv_DataBinding_Boolean + CheckBoxAdv_DataBinding_Boolean + v4.6 + 512 + true + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + True + + + packages\Syncfusion.Grid.Base.18.2.0.44\lib\net46\Syncfusion.Grid.Base.dll + + + packages\Syncfusion.Grid.Windows.18.2.0.44\lib\net46\Syncfusion.Grid.Windows.dll + + + packages\Syncfusion.Licensing.18.2.0.44\lib\net46\Syncfusion.Licensing.dll + + + packages\Syncfusion.Shared.Base.18.2.0.44\lib\net46\Syncfusion.Shared.Base.dll + + + packages\Syncfusion.Shared.Windows.18.2.0.44\lib\net46\Syncfusion.Shared.Windows.dll + + + packages\Syncfusion.SpellChecker.Base.18.2.0.44\lib\net46\Syncfusion.SpellChecker.Base.dll + + + packages\Syncfusion.Tools.Base.18.2.0.44\lib\net46\Syncfusion.Tools.Base.dll + + + packages\Syncfusion.Tools.Windows.18.2.0.44\lib\net46\Syncfusion.Tools.Windows.dll + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + Always + + + Always + Database1.mdf + + + + + False + Microsoft .NET Framework 4.6 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/IntegerValue/CheckBoxAdv_DataBinding_Boolean.csproj.user b/IntegerValue/CheckBoxAdv_DataBinding_Boolean.csproj.user new file mode 100644 index 0000000..626fbdd --- /dev/null +++ b/IntegerValue/CheckBoxAdv_DataBinding_Boolean.csproj.user @@ -0,0 +1,13 @@ + + + + + + + + + + en-US + false + + \ No newline at end of file diff --git a/IntegerValue/CheckBoxAdv_DataBinding_Boolean.sln b/IntegerValue/CheckBoxAdv_DataBinding_Boolean.sln new file mode 100644 index 0000000..d76a105 --- /dev/null +++ b/IntegerValue/CheckBoxAdv_DataBinding_Boolean.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30225.117 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckBoxAdv_DataBinding_Boolean", "CheckBoxAdv_DataBinding_Boolean.csproj", "{78CB1CD0-3B83-4A0E-A39F-8C1363642B58}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78CB1CD0-3B83-4A0E-A39F-8C1363642B58}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F1E82705-F416-4603-81E3-158F318050F0} + EndGlobalSection +EndGlobal diff --git a/IntegerValue/Database1.mdf b/IntegerValue/Database1.mdf new file mode 100644 index 0000000..31b4c26 Binary files /dev/null and b/IntegerValue/Database1.mdf differ diff --git a/IntegerValue/Database1_log.ldf b/IntegerValue/Database1_log.ldf new file mode 100644 index 0000000..3cfb7fd Binary files /dev/null and b/IntegerValue/Database1_log.ldf differ diff --git a/IntegerValue/Form1.Designer.cs b/IntegerValue/Form1.Designer.cs new file mode 100644 index 0000000..b958875 --- /dev/null +++ b/IntegerValue/Form1.Designer.cs @@ -0,0 +1,79 @@ +namespace CheckBoxAdv_DataBinding_Boolean +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.checkBoxAdv1 = new Syncfusion.Windows.Forms.Tools.CheckBoxAdv(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv1)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(12, 53); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowHeadersWidth = 51; + this.dataGridView1.RowTemplate.Height = 24; + this.dataGridView1.Size = new System.Drawing.Size(473, 315); + this.dataGridView1.TabIndex = 0; + // + // checkBoxAdv1 + // + this.checkBoxAdv1.BeforeTouchSize = new System.Drawing.Size(168, 39); + this.checkBoxAdv1.ImageCheckBoxSize = new System.Drawing.Size(16, 16); + this.checkBoxAdv1.Location = new System.Drawing.Point(570, 173); + this.checkBoxAdv1.Name = "checkBoxAdv1"; + this.checkBoxAdv1.Size = new System.Drawing.Size(168, 39); + this.checkBoxAdv1.TabIndex = 1; + this.checkBoxAdv1.Text = "checkBoxAdv1"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(711, 443); + this.Controls.Add(this.checkBoxAdv1); + this.Controls.Add(this.dataGridView1); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkBoxAdv1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView1; + private Syncfusion.Windows.Forms.Tools.CheckBoxAdv checkBoxAdv1; + } +} + diff --git a/IntegerValue/Form1.cs b/IntegerValue/Form1.cs new file mode 100644 index 0000000..c801656 --- /dev/null +++ b/IntegerValue/Form1.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CheckBoxAdv_DataBinding_Boolean +{ + public partial class Form1 : Form + { + public static string dataBasePath = Path.GetFullPath("..\\..\\Database1.mdf"); + public string connectString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + dataBasePath + ";Integrated Security=True"; + public Form1() + { + InitializeComponent(); + + using (SqlConnection sqlConnection = new SqlConnection(connectString)) + { + sqlConnection.Open(); + + SqlDataAdapter dataAdapter = new SqlDataAdapter("SELECT * FROM [Table]", sqlConnection); + + DataTable dataTable = new DataTable("Table"); + dataAdapter.Fill(dataTable); + + dataGridView1.DataSource = dataTable; + this.checkBoxAdv1.DataBindings.Add("IntValue", dataTable, "integerValue"); + + } + } + + + } +} diff --git a/IntegerValue/Form1.resx b/IntegerValue/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/IntegerValue/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/IntegerValue/Program.cs b/IntegerValue/Program.cs new file mode 100644 index 0000000..2cbc43c --- /dev/null +++ b/IntegerValue/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CheckBoxAdv_DataBinding_Boolean +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/IntegerValue/Properties/AssemblyInfo.cs b/IntegerValue/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..337148b --- /dev/null +++ b/IntegerValue/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CheckBoxAdv_DataBinding_Boolean")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CheckBoxAdv_DataBinding_Boolean")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("78cb1cd0-3b83-4a0e-a39f-8c1363642b58")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/IntegerValue/Properties/Resources.Designer.cs b/IntegerValue/Properties/Resources.Designer.cs new file mode 100644 index 0000000..bff1b52 --- /dev/null +++ b/IntegerValue/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CheckBoxAdv_DataBinding_Boolean.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CheckBoxAdv_DataBinding_Boolean.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/IntegerValue/Properties/Resources.resx b/IntegerValue/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/IntegerValue/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/IntegerValue/Properties/Settings.Designer.cs b/IntegerValue/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d48e71f --- /dev/null +++ b/IntegerValue/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CheckBoxAdv_DataBinding_Boolean.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/IntegerValue/Properties/Settings.settings b/IntegerValue/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/IntegerValue/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/IntegerValue/packages.config b/IntegerValue/packages.config new file mode 100644 index 0000000..3f8eea3 --- /dev/null +++ b/IntegerValue/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 5935bfc..67f7ea0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # How-to-bind-winforms-checkboxadv-to-sql-database -This session explains how to bind winforms checkboxadv to sql database + +A concise walkthrough to bind the Syncfusion WinForms CheckBoxAdv control to a SQL Server database, including reading and updating a bit/bool field. + +## Overview +This sample explains how to: +- Load a boolean/bit value from SQL Server and bind it to CheckBoxAdv +- Support two-state or three-state (Indeterminate) values +- Push user changes back to the database +- Handle DBNull and value mapping scenarios + +## Notes on Binding Modes +- Two-state only (true/false): + - Set ThreeState = false + - Bind the "Checked" property: `checkBoxAdv.DataBindings.Add("Checked", current, "IsActive", true, DataSourceUpdateMode.OnPropertyChanged);` +- Three-state (true/false/null): + - Set ThreeState = true + - Bind the "CheckState" property with a null (DBNull) mapping as shown above + +## Troubleshooting +- DBNull issues: Use ThreeState and bind to CheckState with a null mapping. +- Update not saving: Ensure your table has a primary key and that SqlCommandBuilder can generate commands. +- Designer toolbox: Install Syncfusion packages and rebuild the project if controls do not appear. +- Connection failures: Validate the connection string and server accessibility. + +## About the sample +This sample describes how to bind Syncfusion WinForms CheckBoxAdv to a SQL database within this sample. Adjust namespaces, package versions, and connection strings based on your environment.