Error: variable not declared in GUI design file - c#

Newbie question. I downloaded the source of a project written in C#. There is an error occurring in one of the designer files used for constructing the GUI. Source attached below:
namespace Neurotec.Samples
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPageEnrollFromFile = new System.Windows.Forms.TabPage();
this.enrollFromFilePanel = new Neurotec.Samples.EnrollFromFile();
this.tabPageEnrollFromMicrophone = new System.Windows.Forms.TabPage();
this.enrollFromMicrophonePanel = new Neurotec.Samples.EnrollFromMicrophone();
this.tabPageVerify = new System.Windows.Forms.TabPage();
this.verifyVoicePanel = new Neurotec.Samples.VerifyVoice();
this.tabPageIdentify = new System.Windows.Forms.TabPage();
this.identifyVoicePanel = new Neurotec.Samples.IdentifyVoice();
this.tabControl1.SuspendLayout();
this.tabPageEnrollFromFile.SuspendLayout();
this.tabPageEnrollFromMicrophone.SuspendLayout();
this.tabPageVerify.SuspendLayout();
this.tabPageIdentify.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPageEnrollFromFile);
this.tabControl1.Controls.Add(this.tabPageEnrollFromMicrophone);
this.tabControl1.Controls.Add(this.tabPageVerify);
this.tabControl1.Controls.Add(this.tabPageIdentify);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(551, 398);
this.tabControl1.TabIndex = 0;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.TabControlSelectedIndexChanged);
//
// enrollFromFilePanel
//
this.enrollFromFilePanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.enrollFromFilePanel.Location = new System.Drawing.Point(3, 3);
this.enrollFromFilePanel.Name = "enrollFromFilePanel";
this.enrollFromFilePanel.Size = new System.Drawing.Size(540, 316);
this.enrollFromFilePanel.TabIndex = 0;
//
// tabPageEnrollFromFile
//
this.tabPageEnrollFromFile.Controls.Add(this.enrollFromFilePanel);
this.tabPageEnrollFromFile.Location = new System.Drawing.Point(4, 22);
this.tabPageEnrollFromFile.Name = "tabPageEnrollFromFile";
this.tabPageEnrollFromFile.Padding = new System.Windows.Forms.Padding(3);
this.tabPageEnrollFromFile.Size = new System.Drawing.Size(546, 322);
this.tabPageEnrollFromFile.TabIndex = 0;
this.tabPageEnrollFromFile.Text = "Enroll From File";
this.tabPageEnrollFromFile.UseVisualStyleBackColor = true;
//
// tabPageEnrollFromMicrophone
//
this.tabPageEnrollFromMicrophone.Controls.Add(this.enrollFromMicrophonePanel);
this.tabPageEnrollFromMicrophone.Location = new System.Drawing.Point(4, 22);
this.tabPageEnrollFromMicrophone.Name = "tabPageEnrollFromMicrophone";
this.tabPageEnrollFromMicrophone.Padding = new System.Windows.Forms.Padding(3);
this.tabPageEnrollFromMicrophone.Size = new System.Drawing.Size(546, 322);
this.tabPageEnrollFromMicrophone.TabIndex = 1;
this.tabPageEnrollFromMicrophone.Text = "Enroll From Microphone";
this.tabPageEnrollFromMicrophone.UseVisualStyleBackColor = true;
//
// enrollFromMicrophonePanel
//
this.enrollFromMicrophonePanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.enrollFromMicrophonePanel.Location = new System.Drawing.Point(3, 3);
this.enrollFromMicrophonePanel.Name = "enrollFromMicrophonePanel";
this.enrollFromMicrophonePanel.Size = new System.Drawing.Size(540, 316);
this.enrollFromMicrophonePanel.TabIndex = 0;
//
// tabPageVerify
//
this.tabPageVerify.Controls.Add(this.verifyVoicePanel);
this.tabPageVerify.Location = new System.Drawing.Point(4, 22);
this.tabPageVerify.Name = "tabPageVerify";
this.tabPageVerify.Size = new System.Drawing.Size(546, 322);
this.tabPageVerify.TabIndex = 2;
this.tabPageVerify.Text = "Verify Voice";
this.tabPageVerify.UseVisualStyleBackColor = true;
//
// verifyVoicePanel
//
this.verifyVoicePanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.verifyVoicePanel.Location = new System.Drawing.Point(0, 0);
this.verifyVoicePanel.Name = "verifyVoicePanel";
this.verifyVoicePanel.Size = new System.Drawing.Size(546, 322);
this.verifyVoicePanel.TabIndex = 0;
//
// tabPageIdentify
//
this.tabPageIdentify.Controls.Add(this.identifyVoicePanel);
this.tabPageIdentify.Location = new System.Drawing.Point(4, 22);
this.tabPageIdentify.Name = "tabPageIdentify";
this.tabPageIdentify.Size = new System.Drawing.Size(543, 372);
this.tabPageIdentify.TabIndex = 3;
this.tabPageIdentify.Text = "Identify Voice";
this.tabPageIdentify.UseVisualStyleBackColor = true;
//
// identifyVoicePanel
//
this.identifyVoicePanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.identifyVoicePanel.Location = new System.Drawing.Point(0, 0);
this.identifyVoicePanel.Name = "identifyVoicePanel";
this.identifyVoicePanel.Size = new System.Drawing.Size(543, 372);
this.identifyVoicePanel.TabIndex = 0;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(551, 398);
this.Controls.Add(this.tabControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "MainForm";
this.Text = "Simple Voices Sample";
this.Load += new System.EventHandler(this.MainFormLoad);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormFormClosing);
this.tabControl1.ResumeLayout(false);
this.tabPageEnrollFromFile.ResumeLayout(false);
this.tabPageEnrollFromMicrophone.ResumeLayout(false);
this.tabPageVerify.ResumeLayout(false);
this.tabPageIdentify.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPageEnrollFromFile;
private System.Windows.Forms.TabPage tabPageEnrollFromMicrophone;
private System.Windows.Forms.TabPage tabPageVerify;
private System.Windows.Forms.TabPage tabPageIdentify;
private EnrollFromFile enrollFromFilePanel;
private EnrollFromMicrophone enrollFromMicrophonePanel;
private VerifyVoice verifyVoicePanel;
private IdentifyVoice identifyVoicePanel;
}
}
The errors state that some variables were undeclared or unassigned. As an example, the variable "enrollFromFilePanel" is said to be undeclared but it was created with the line "private EnrollFromFile enrollFromFilePanel;". I am sorry that I cannot provide an sscce and I hope that the solution is something simple. Thank you.

Related

Visual Studio Designer Cannot open a file Despite it being the first and only Class in the file

Whereas MSDN suggests that some incompatible behavior might also cause this issue
In my case, The incompatible behavior is caused by some possibly weird(messed up mappings) on Entity Framework.
I have done due diligence to ensure one-to-one correspondence between the data model and the EF model(even recreated it twice, ground up)
The project builds and runs when I comment out a certain section of code.
public partial class TestForm : SecureForm
{
private myEntities _db = new myEntities();
public TestForm()
{
InitializeComponent();
PopulateTestsList();
}
private void PopulateTestsList()
{
listViewTypes.Items.Clear();
var query = from q in _db.Types orderby q.TypeName select q;
foreach (Type dt in query)
{
ListViewItem lvi = new ListViewItem(new string[]
{
dt.TypeName
});
lvi.Tag = dt;
listViewTypes.Items.Add(lvi);
}
}
private void buttonAdd_Click(object sender, EventArgs e)
{
TestEditForm myEditForm = new TestEditForm(_db);
if (myEditForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
PopulateTestsList();
}
private void buttonEdit_Click(object sender, EventArgs e)
{
if (listViewTypes.SelectedItems.Count > 0)
{
Test tsdt = listViewTypes.SelectedItems[0].Tag as Test;
if (myEditForm != null)
{
TestEditForm myEditForm = new TestEditForm(_db, mysForm);
if (myEditForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
PopulateTestsList();
}
}
}
}
It still does not show up the designer.
Here's the designer.cs for reference
partial class TestForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonDelete = new System.Windows.Forms.Button();
this.buttonEdit = new System.Windows.Forms.Button();
this.buttonAdd = new System.Windows.Forms.Button();
this.listViewTypes = new System.Windows.Forms.ListView();
this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// buttonDelete
//
this.buttonDelete.Location = new System.Drawing.Point(304, 86);
this.buttonDelete.Name = "buttonDelete";
this.buttonDelete.Size = new System.Drawing.Size(75, 23);
this.buttonDelete.TabIndex = 9;
this.buttonDelete.Text = "Delete";
this.buttonDelete.UseVisualStyleBackColor = true;
this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
//
// buttonEdit
//
this.buttonEdit.Location = new System.Drawing.Point(304, 56);
this.buttonEdit.Name = "buttonEdit";
this.buttonEdit.Size = new System.Drawing.Size(75, 23);
this.buttonEdit.TabIndex = 8;
this.buttonEdit.Text = "Edit";
this.buttonEdit.UseVisualStyleBackColor = true;
this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
//
// buttonAdd
//
this.buttonAdd.Location = new System.Drawing.Point(304, 26);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(75, 23);
this.buttonAdd.TabIndex = 7;
this.buttonAdd.Text = "Add";
this.buttonAdd.UseVisualStyleBackColor = true;
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
//
// listViewTypes
//
this.listViewTypes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnName});
this.listViewTypes.FullRowSelect = true;
this.listViewTypes.HideSelection = false;
this.listViewTypes.Location = new System.Drawing.Point(12, 26);
this.listViewTypes.Name = "listViewTypes";
this.listViewTypes.Size = new System.Drawing.Size(274, 205);
this.listViewTypes.TabIndex = 6;
this.listViewTypes.UseCompatibleStateImageBehavior = false;
this.listViewTypes.View = System.Windows.Forms.View.Details;
//
// columnName
//
this.columnName.Text = "Document Type";
this.columnName.Width = 270;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 10);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(79, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Test Standards";
//
// TestsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(395, 242);
this.Controls.Add(this.buttonDelete);
this.Controls.Add(this.buttonEdit);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.listViewTypes);
this.Controls.Add(this.label1);
this.Name = "TestsForm";
this.Opacity = 1D;
this.Text = "Test Standards";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonDelete;
private System.Windows.Forms.Button buttonEdit;
private System.Windows.Forms.Button buttonAdd;
private System.Windows.Forms.ListView listViewTypes;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.Label label1;
}
Code analysis shows that the form is missing,(MSBuild does not). MSBUILD compiles the form into an exe thats kinda defunct(on the broken entity)
The entity in question has Name & ID properties. Both Name and ID are mapped properly, The collection is pluralized and loaded into a list.
How to identify the broken entity and/or
How to Identify the non-compatible behavior in the code

How to bind data to a custom Windows Form using SplitContainer?

I've created a form that I call a ListChooser. It looks like so:
It consists of a System.Windows.Forms.Button and .TextBox.
Clicking on the Button (shown above with the text "Fruits") causes a dialog to popup and some selections are made and the TextBox is populated, like so:
My problem is I can't figure out how to set a System.Windows.Forms.Binding to this TextBox. I think the complication is that it's not just a TextBox, it's 2 components in one. (I know how to data bind with just a standalone TextBox). If I go to the TextBox > Properties > DataBindings > Advanced > ..., All entries listed under Property are not selectable:
I've tried this which has no effect:
private System.Windows.Forms.BindingSource myBindingSource;
this.myBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.myBindingSource.DataSource = typeof(Foods) // Fruits is a Property of Foods;
myListChooser.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.myBindingSource, "Fruits", true));
How do I do this?
ListChooser.Designer.cs:
partial class ListChooser: UserControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnPopup = new System.Windows.Forms.Button();
this.textBox = new System.Windows.Forms.TextBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// btnPopup
//
this.btnPopup.AutoSize = true;
this.btnPopup.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnPopup.Location = new System.Drawing.Point(0, 0);
this.btnPopup.Margin = new System.Windows.Forms.Padding(0);
this.btnPopup.Name = "btnPopup";
this.btnPopup.Size = new System.Drawing.Size(75, 21);
this.btnPopup.TabIndex = 0;
this.btnPopup.Text = "Type";
this.btnPopup.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnPopup.UseVisualStyleBackColor = true;
this.btnPopup.Click += new System.EventHandler(this.btnPopup_Click);
//
// txtList
//
this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox.BackColor = System.Drawing.SystemColors.Window;
this.textBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox.Location = new System.Drawing.Point(0, 0);
this.textBox.Name = "txtList";
this.textBox.ReadOnly = true;
this.textBox.Size = new System.Drawing.Size(297, 20);
this.textBox.TabIndex = 1;
this.textBox.TabStop = false;
this.textBox.TextChanged += new System.EventHandler(this.txtList_TextChanged);
//this.textBox.Leave += new System.EventHandler(this.txtList_Leave);
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnPopup);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.textBox);
this.splitContainer1.Size = new System.Drawing.Size(375, 21);
this.splitContainer1.SplitterDistance = 75;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 2;
//
// ListChooser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.WhiteSmoke;
this.Controls.Add(this.splitContainer1);
this.MaximumSize = new System.Drawing.Size(1200, 21);
this.Name = "ListChooser";
this.Size = new System.Drawing.Size(375, 21);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnPopup;
private System.Windows.Forms.TextBoxBase textBox;
private SplitContainer splitContainer1;
}

c# chart axis not displaying when form is loaded

For some reason the axis and grid is not being displayed on the c# chart. as you can see from the two pictures, the background of the chart is being displayed, but nothing else is. Can anyone help me figure out why the grid and information from the chart is not being displayed?
The form from designer in visual studio:
The form at runtime:
namespace Harman.Generic.Framework.WaveformMaker
{
partial class WaveformMaker
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuStrip = new System.Windows.Forms.MenuStrip();
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
this.mnuFileSaveWaveform = new System.Windows.Forms.ToolStripMenuItem();
this.mnuFileExit = new System.Windows.Forms.ToolStripMenuItem();
this.btnRun = new System.Windows.Forms.Button();
this.lblPointVoltage = new System.Windows.Forms.Label();
this.lblPointDuration = new System.Windows.Forms.Label();
this.dgdPointList = new System.Windows.Forms.DataGridView();
this.colPoint = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colVoltage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colDuration = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.btnRemovePoint = new System.Windows.Forms.Button();
this.btnAddPoint = new System.Windows.Forms.Button();
this.chWaveform = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.mnuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgdPointList)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.chWaveform)).BeginInit();
this.SuspendLayout();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
//
// mnuStrip
//
this.mnuStrip.BackColor = System.Drawing.SystemColors.Control;
this.mnuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuFile});
this.mnuStrip.Location = new System.Drawing.Point(0, 0);
this.mnuStrip.Name = "mnuStrip";
this.mnuStrip.Size = new System.Drawing.Size(894, 24);
this.mnuStrip.TabIndex = 2;
this.mnuStrip.Text = "menuStrip1";
//
// mnuFile
//
this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuFileSaveWaveform,
this.mnuFileExit});
this.mnuFile.Name = "mnuFile";
this.mnuFile.Size = new System.Drawing.Size(37, 20);
this.mnuFile.Text = "File";
//
// mnuFileSaveWaveform
//
this.mnuFileSaveWaveform.Name = "mnuFileSaveWaveform";
this.mnuFileSaveWaveform.Size = new System.Drawing.Size(156, 22);
this.mnuFileSaveWaveform.Text = "Save Waveform";
//
// mnuFileExit
//
this.mnuFileExit.Name = "mnuFileExit";
this.mnuFileExit.Size = new System.Drawing.Size(156, 22);
this.mnuFileExit.Text = "Exit";
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(621, 562);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(83, 23);
this.btnRun.TabIndex = 4;
this.btnRun.Text = "Run";
this.btnRun.UseVisualStyleBackColor = true;
//
// lblPointVoltage
//
this.lblPointVoltage.AutoSize = true;
this.lblPointVoltage.Location = new System.Drawing.Point(10, 572);
this.lblPointVoltage.Name = "lblPointVoltage";
this.lblPointVoltage.Size = new System.Drawing.Size(49, 13);
this.lblPointVoltage.TabIndex = 6;
this.lblPointVoltage.Text = "Voltage: ";
//
// lblPointDuration
//
this.lblPointDuration.AutoSize = true;
this.lblPointDuration.Location = new System.Drawing.Point(65, 572);
this.lblPointDuration.Name = "lblPointDuration";
this.lblPointDuration.Size = new System.Drawing.Size(58, 13);
this.lblPointDuration.TabIndex = 7;
this.lblPointDuration.Text = "Time (ms): ";
//
// dgdPointList
//
this.dgdPointList.AllowUserToAddRows = false;
this.dgdPointList.AllowUserToResizeColumns = false;
this.dgdPointList.AllowUserToResizeRows = false;
this.dgdPointList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgdPointList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colPoint,
this.colVoltage,
this.colDuration});
this.dgdPointList.Location = new System.Drawing.Point(710, 28);
this.dgdPointList.MultiSelect = false;
this.dgdPointList.Name = "dgdPointList";
this.dgdPointList.RowHeadersVisible = false;
this.dgdPointList.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.dgdPointList.Size = new System.Drawing.Size(172, 528);
this.dgdPointList.TabIndex = 8;
//
// colPoint
//
this.colPoint.HeaderText = "Point";
this.colPoint.Name = "colPoint";
this.colPoint.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.colPoint.Width = 56;
//
// colVoltage
//
this.colVoltage.HeaderText = "Voltage";
this.colVoltage.Name = "colVoltage";
this.colVoltage.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.colVoltage.Width = 56;
//
// colDuration
//
this.colDuration.HeaderText = "Duration";
this.colDuration.Name = "colDuration";
this.colDuration.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.colDuration.Width = 56;
//
// btnRemovePoint
//
this.btnRemovePoint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.btnRemovePoint.Location = new System.Drawing.Point(799, 562);
this.btnRemovePoint.Name = "btnRemovePoint";
this.btnRemovePoint.Size = new System.Drawing.Size(83, 23);
this.btnRemovePoint.TabIndex = 9;
this.btnRemovePoint.Text = "Remove Point";
this.btnRemovePoint.UseVisualStyleBackColor = true;
//
// btnAddPoint
//
this.btnAddPoint.Location = new System.Drawing.Point(710, 562);
this.btnAddPoint.Name = "btnAddPoint";
this.btnAddPoint.Size = new System.Drawing.Size(83, 23);
this.btnAddPoint.TabIndex = 10;
this.btnAddPoint.Text = "Add Point";
this.btnAddPoint.UseVisualStyleBackColor = true;
this.btnAddPoint.Click += new System.EventHandler(this.btnAddPoint_Click);
//
// chWaveform
//
this.chWaveform.BackColor = System.Drawing.SystemColors.Control;
this.chWaveform.BorderlineColor = System.Drawing.SystemColors.WindowText;
chartArea1.Area3DStyle.LightStyle = System.Windows.Forms.DataVisualization.Charting.LightStyle.Realistic;
chartArea1.AxisX.MajorGrid.Interval = 1000D;
chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
chartArea1.AxisX.MajorTickMark.Interval = 1000D;
chartArea1.AxisX.Maximum = 5000D;
chartArea1.AxisX.Minimum = 0D;
chartArea1.AxisX.MinorGrid.Enabled = true;
chartArea1.AxisX.MinorGrid.Interval = 100D;
chartArea1.AxisX.MinorGrid.LineColor = System.Drawing.Color.WhiteSmoke;
chartArea1.AxisX.Title = "Time (seconds)";
chartArea1.AxisX2.IsStartedFromZero = false;
chartArea1.AxisY.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount;
chartArea1.AxisY.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
chartArea1.AxisY.MajorTickMark.Interval = 1D;
chartArea1.AxisY.MajorTickMark.IntervalOffset = 0D;
chartArea1.AxisY.MajorTickMark.IntervalOffsetType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Auto;
chartArea1.AxisY.MajorTickMark.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.AxisY.MajorTickMark.TickMarkStyle = System.Windows.Forms.DataVisualization.Charting.TickMarkStyle.AcrossAxis;
chartArea1.AxisY.Maximum = 16D;
chartArea1.AxisY.Minimum = 0D;
chartArea1.AxisY.MinorGrid.Enabled = true;
chartArea1.AxisY.MinorGrid.Interval = 0.25D;
chartArea1.AxisY.MinorGrid.LineColor = System.Drawing.Color.WhiteSmoke;
chartArea1.AxisY.MinorTickMark.Enabled = true;
chartArea1.AxisY.MinorTickMark.Interval = 0.25D;
chartArea1.AxisY.MinorTickMark.Size = 0.25F;
chartArea1.AxisY.MinorTickMark.TickMarkStyle = System.Windows.Forms.DataVisualization.Charting.TickMarkStyle.AcrossAxis;
chartArea1.AxisY.Title = "Voltage";
chartArea1.Name = "ChartArea1";
this.chWaveform.ChartAreas.Add(chartArea1);
legend1.Enabled = false;
legend1.Name = "Legend1";
this.chWaveform.Legends.Add(legend1);
this.chWaveform.Location = new System.Drawing.Point(13, 28);
this.chWaveform.Name = "chWaveform";
this.chWaveform.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.Excel;
series1.ChartArea = "ChartArea1";
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StepLine;
series1.Legend = "Legend1";
series1.Name = "Series1";
this.chWaveform.Series.Add(series1);
this.chWaveform.Size = new System.Drawing.Size(691, 528);
this.chWaveform.TabIndex = 5;
this.chWaveform.Click += new System.EventHandler(this.chWaveform_Click);
//
// WaveformMaker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(894, 594);
this.Controls.Add(this.btnAddPoint);
this.Controls.Add(this.btnRemovePoint);
this.Controls.Add(this.dgdPointList);
this.Controls.Add(this.lblPointDuration);
this.Controls.Add(this.lblPointVoltage);
this.Controls.Add(this.chWaveform);
this.Controls.Add(this.btnRun);
this.Controls.Add(this.mnuStrip);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "WaveformMaker";
this.Text = "Waveform Maker";
this.Load += new System.EventHandler(this.WaveformMaker_Load);
this.mnuStrip.ResumeLayout(false);
this.mnuStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgdPointList)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chWaveform)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.MenuStrip mnuStrip;
private System.Windows.Forms.ToolStripMenuItem mnuFile;
private System.Windows.Forms.ToolStripMenuItem mnuFileSaveWaveform;
private System.Windows.Forms.ToolStripMenuItem mnuFileExit;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Label lblPointVoltage;
private System.Windows.Forms.Label lblPointDuration;
private System.Windows.Forms.DataGridView dgdPointList;
private System.Windows.Forms.DataGridViewTextBoxColumn colPoint;
private System.Windows.Forms.DataGridViewTextBoxColumn colVoltage;
private System.Windows.Forms.DataGridViewTextBoxColumn colDuration;
private System.Windows.Forms.Button btnRemovePoint;
private System.Windows.Forms.Button btnAddPoint;
private System.Windows.Forms.DataVisualization.Charting.Chart chWaveform;
}
}
Your code works fine but you need to add a DataPoint to trigger the Chart's display.
This is most likely because without any data the automatic settings, which are default for most elements, including ChartArea's Size, have nothing to work from. I tried it and after adding even a dummy point the grid and all other nice details will show just fine..:
As you can see clearing the DataPoints will wipe out the chart again..
If you want your Series clean of dummy data you can either delete the dummy after adding the first data or add a dummy series..

Cannot view data

I have covered many tutorials and articles but can not find exactly what I need to assist me in resolving my issue.
My issue is that my compiled dll does not return rows of data from my SQL database file to the DataGridView.
I have created this project as a windows application for testing and it works fine. However, when I change the output to a class library it runs but does not return any data to the DataGridView. The header is there, because it is declared, but I have a feeling the compiled dll can not establish a connection to the database.
I have experience with C# and ASP but not in creating dll's.
To also clarify further, I can use the dataset or the bindingsource before I compile and view all the records using the Preview Data option. Is there a specific way you have to setup the database connection when creating a class library in my situation?
SQLDatabase.mdf Connection String:
Data Source=(localdb)\v11.0;Initial Catalog=SQLDatabase.mdf;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
Designer Generated Code: this.itemsTableAdapter.Fill(this.abDataSet.Items);
Please let me know if you would like me to post the Form.Designer.cs which was Designer Generated Code as well. Again, everything works fine as a Windows Application but as a Class Library the rows of data are never displayed in the DataGridView.
namespace AHPriceChecker4Free
{
public class AHPriceChecker : Core
{
private Thread formThread;
public void PluginStop()
{
Log("closed");
}
private AHCheckerForm ahForm;
public bool formIsOpen;
public void PluginRun()
{
formThread = new Thread(RunForm);
formThread.SetApartmentState(ApartmentState.STA);
formThread.Start();
formIsOpen = true;
while (formIsOpen)
{
Thread.Sleep(1000);
}
}
private void RunForm()
{
ahForm = new AHCheckerForm(this, me);
System.Windows.Forms.Application.Run(ahForm);
}
}
}
Form.cs
namespace AHPriceChecker4Free
{
partial class AHCheckerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AHCheckerForm));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.tsmMain = new System.Windows.Forms.ToolStripMenuItem();
this.tsmLoad = new System.Windows.Forms.ToolStripMenuItem();
this.tsmSave = new System.Windows.Forms.ToolStripMenuItem();
this.txtItemName = new System.Windows.Forms.TextBox();
this.btnSearch = new System.Windows.Forms.Button();
this.ofdOpen = new System.Windows.Forms.OpenFileDialog();
this.sfdSave = new System.Windows.Forms.SaveFileDialog();
this.btnMassSearch = new System.Windows.Forms.Button();
this.itemPriceHistory = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.itemAveragePrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.itemLastPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.itemName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgvAuctionTable = new System.Windows.Forms.DataGridView();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label();
this.rtbSave = new System.Windows.Forms.RichTextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.idDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.itemNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.goldDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.silverDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.copperDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.perQtyDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.abchristDataSet = new AHPriceChecker4Free.abchristDataSet();
this.itemsTableAdapter = new AHPriceChecker4Free.abchristDataSetTableAdapters.ItemsTableAdapter();
this.itemsBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvAuctionTable)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.abchristDataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.itemsBindingSource1)).BeginInit();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmMain});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(819, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
this.menuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.menuStrip1_ItemClicked);
//
// tsmMain
//
this.tsmMain.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmLoad,
this.tsmSave});
this.tsmMain.Name = "tsmMain";
this.tsmMain.Size = new System.Drawing.Size(41, 20);
this.tsmMain.Text = "&Main";
//
// tsmLoad
//
this.tsmLoad.Name = "tsmLoad";
this.tsmLoad.Size = new System.Drawing.Size(123, 22);
this.tsmLoad.Text = "&Load data";
this.tsmLoad.Click += new System.EventHandler(this.tsmLoad_Click);
//
// tsmSave
//
this.tsmSave.Name = "tsmSave";
this.tsmSave.Size = new System.Drawing.Size(123, 22);
this.tsmSave.Text = "&Save data";
this.tsmSave.Click += new System.EventHandler(this.transferDataToSave);
//
// txtItemName
//
this.txtItemName.BackColor = System.Drawing.Color.LightYellow;
this.txtItemName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtItemName.Location = new System.Drawing.Point(8, 353);
this.txtItemName.Name = "txtItemName";
this.txtItemName.Size = new System.Drawing.Size(203, 20);
this.txtItemName.TabIndex = 2;
//
// btnSearch
//
this.btnSearch.BackColor = System.Drawing.Color.LightYellow;
this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearch.Location = new System.Drawing.Point(217, 351);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(87, 25);
this.btnSearch.TabIndex = 5;
this.btnSearch.Text = "Search";
this.btnSearch.UseVisualStyleBackColor = false;
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// ofdOpen
//
this.ofdOpen.FileName = "openFileDialog1";
//
// sfdSave
//
this.sfdSave.FileOk += new System.ComponentModel.CancelEventHandler(this.sfdSave_FileOk);
//
// btnMassSearch
//
this.btnMassSearch.BackColor = System.Drawing.Color.LightYellow;
this.btnMassSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMassSearch.Location = new System.Drawing.Point(310, 351);
this.btnMassSearch.Name = "btnMassSearch";
this.btnMassSearch.Size = new System.Drawing.Size(105, 25);
this.btnMassSearch.TabIndex = 8;
this.btnMassSearch.Text = "Mass search";
this.btnMassSearch.UseVisualStyleBackColor = false;
this.btnMassSearch.Click += new System.EventHandler(this.btnMassSearch_Click);
//
// itemPriceHistory
//
this.itemPriceHistory.HeaderText = "Price History";
this.itemPriceHistory.Name = "itemPriceHistory";
this.itemPriceHistory.ReadOnly = true;
this.itemPriceHistory.Width = 350;
//
// itemAveragePrice
//
this.itemAveragePrice.HeaderText = "Average price";
this.itemAveragePrice.Name = "itemAveragePrice";
this.itemAveragePrice.ReadOnly = true;
this.itemAveragePrice.Width = 110;
//
// itemLastPrice
//
this.itemLastPrice.HeaderText = "Last price";
this.itemLastPrice.Name = "itemLastPrice";
//
// itemName
//
this.itemName.Frozen = true;
this.itemName.HeaderText = "Name";
this.itemName.Name = "itemName";
this.itemName.ReadOnly = true;
this.itemName.Width = 200;
//
// dgvAuctionTable
//
this.dgvAuctionTable.BackgroundColor = System.Drawing.Color.Cornsilk;
this.dgvAuctionTable.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvAuctionTable.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.itemName,
this.itemLastPrice,
this.itemAveragePrice,
this.itemPriceHistory});
this.dgvAuctionTable.Dock = System.Windows.Forms.DockStyle.Top;
this.dgvAuctionTable.Location = new System.Drawing.Point(3, 3);
this.dgvAuctionTable.Name = "dgvAuctionTable";
this.dgvAuctionTable.RowHeadersVisible = false;
this.dgvAuctionTable.Size = new System.Drawing.Size(805, 342);
this.dgvAuctionTable.TabIndex = 1;
this.dgvAuctionTable.CurrentCellDirtyStateChanged += new System.EventHandler(this.dgvAuctionTable_CurrentCellDirtyStateChanged);
//
**// *** REMOVED ALL TABS BUT THE ONE I AM HAVING AN ISSUE WITH TO REDUCE SIZE. THIS FORM BODY IS LIMITED TO 30000 CHARACTERS WHEN POSTING *** //
//**
// tabPage4
//
this.tabPage4.Controls.Add(this.dataGridView1);
this.tabPage4.Location = new System.Drawing.Point(4, 23);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(811, 381);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Database";
this.tabPage4.UseVisualStyleBackColor = true;
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.idDataGridViewTextBoxColumn,
this.itemNameDataGridViewTextBoxColumn,
this.goldDataGridViewTextBoxColumn,
this.silverDataGridViewTextBoxColumn,
this.copperDataGridViewTextBoxColumn,
this.perQtyDataGridViewTextBoxColumn});
this.dataGridView1.DataSource = this.itemsBindingSource1;
this.dataGridView1.Location = new System.Drawing.Point(66, 69);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.Size = new System.Drawing.Size(669, 194);
this.dataGridView1.TabIndex = 0;
//
// idDataGridViewTextBoxColumn
//
this.idDataGridViewTextBoxColumn.DataPropertyName = "Id";
this.idDataGridViewTextBoxColumn.HeaderText = "Id";
this.idDataGridViewTextBoxColumn.Name = "idDataGridViewTextBoxColumn";
this.idDataGridViewTextBoxColumn.ReadOnly = true;
//
// itemNameDataGridViewTextBoxColumn
//
this.itemNameDataGridViewTextBoxColumn.DataPropertyName = "ItemName";
this.itemNameDataGridViewTextBoxColumn.HeaderText = "ItemName";
this.itemNameDataGridViewTextBoxColumn.Name = "itemNameDataGridViewTextBoxColumn";
this.itemNameDataGridViewTextBoxColumn.ReadOnly = true;
//
// goldDataGridViewTextBoxColumn
//
this.goldDataGridViewTextBoxColumn.DataPropertyName = "Gold";
this.goldDataGridViewTextBoxColumn.HeaderText = "Gold";
this.goldDataGridViewTextBoxColumn.Name = "goldDataGridViewTextBoxColumn";
this.goldDataGridViewTextBoxColumn.ReadOnly = true;
//
// silverDataGridViewTextBoxColumn
//
this.silverDataGridViewTextBoxColumn.DataPropertyName = "Silver";
this.silverDataGridViewTextBoxColumn.HeaderText = "Silver";
this.silverDataGridViewTextBoxColumn.Name = "silverDataGridViewTextBoxColumn";
this.silverDataGridViewTextBoxColumn.ReadOnly = true;
//
// copperDataGridViewTextBoxColumn
//
this.copperDataGridViewTextBoxColumn.DataPropertyName = "Copper";
this.copperDataGridViewTextBoxColumn.HeaderText = "Copper";
this.copperDataGridViewTextBoxColumn.Name = "copperDataGridViewTextBoxColumn";
this.copperDataGridViewTextBoxColumn.ReadOnly = true;
//
// perQtyDataGridViewTextBoxColumn
//
this.perQtyDataGridViewTextBoxColumn.DataPropertyName = "PerQty";
this.perQtyDataGridViewTextBoxColumn.HeaderText = "PerQty";
this.perQtyDataGridViewTextBoxColumn.Name = "perQtyDataGridViewTextBoxColumn";
this.perQtyDataGridViewTextBoxColumn.ReadOnly = true;
//
// abchristDataSet
//
this.abchristDataSet.DataSetName = "abchristDataSet";
this.abchristDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// itemsTableAdapter
//
this.itemsTableAdapter.ClearBeforeFill = true;
//
// itemsBindingSource1
//
this.itemsBindingSource1.DataMember = "Items";
this.itemsBindingSource1.DataSource = this.abchristDataSet;
//
// AHCheckerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Cornsilk;
this.ClientSize = new System.Drawing.Size(819, 432);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "AHCheckerForm";
this.Text = "AHPriceChecker4Free - By Cobras.Club";
this.TopMost = true;
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.AHCheckerForm_FormClosed);
this.Load += new System.EventHandler(this.AHCheckerForm_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvAuctionTable)).EndInit();
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.tabPage4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.abchristDataSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.itemsBindingSource1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem tsmMain;
private System.Windows.Forms.ToolStripMenuItem tsmLoad;
private System.Windows.Forms.TextBox txtItemName;
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.OpenFileDialog ofdOpen;
private System.Windows.Forms.SaveFileDialog sfdSave;
private System.Windows.Forms.Button btnMassSearch;
private System.Windows.Forms.ToolStripMenuItem tsmSave;
private System.Windows.Forms.DataGridViewTextBoxColumn itemPriceHistory;
private System.Windows.Forms.DataGridViewTextBoxColumn itemAveragePrice;
private System.Windows.Forms.DataGridViewTextBoxColumn itemLastPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn itemName;
private System.Windows.Forms.DataGridView dgvAuctionTable;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RichTextBox rtbSave;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.DataGridView dataGridView1;
private abchristDataSet abchristDataSet;
private abchristDataSetTableAdapters.ItemsTableAdapter itemsTableAdapter;
private System.Windows.Forms.DataGridViewTextBoxColumn idDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn itemNameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn goldDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn silverDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn copperDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn perQtyDataGridViewTextBoxColumn;
private System.Windows.Forms.BindingSource itemsBindingSource1;
}
}
You have to add code in your class library that will let you set the connection string. The place to set the connection string is in the constructor of your class library. You can manually add the connection string like this in the app.config:
<connectionStrings>
<add name="MyDB" connectionString="Server=.\SQLExpress;
AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;
Trusted_Connection=Yes;" />
</connectionStrings>
Then access the configuration string like this:
var str = ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString

GUI White becomes Transparent

I wrote a GUI Form in c#. When I executed the program, white color becomes transparent.
It's suppose to be like this:
But when I run, it's like that:
You can see that white color became black like the picture behind.
using System;
using System.Drawing;
namespace Taki_Client
{
partial class SignIn
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnMenu = new System.Windows.Forms.Button();
this.picSignIn = new System.Windows.Forms.PictureBox();
this.btnSubmit = new System.Windows.Forms.Button();
this.tbUsername = new System.Windows.Forms.TextBox();
this.tbPassword = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.picSignIn)).BeginInit();
this.SuspendLayout();
//
// btnMenu
//
this.btnMenu.BackgroundImage = global::Taki_Client.Properties.Resources.Menu_Button;
this.btnMenu.Location = new System.Drawing.Point(314, 476);
this.btnMenu.Name = "btnMenu";
this.btnMenu.Size = new System.Drawing.Size(157, 57);
this.btnMenu.TabIndex = 4;
this.btnMenu.UseVisualStyleBackColor = true;
this.btnMenu.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnExit_MouseClick);
//
// picSignIn
//
this.picSignIn.BackColor = System.Drawing.Color.Transparent;
this.picSignIn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.picSignIn.ErrorImage = null;
this.picSignIn.Image = global::Taki_Client.Properties.Resources.SignIn;
this.picSignIn.ImageLocation = "";
this.picSignIn.Location = new System.Drawing.Point(272, 12);
this.picSignIn.Name = "picSignIn";
this.picSignIn.Size = new System.Drawing.Size(288, 161);
this.picSignIn.TabIndex = 0;
this.picSignIn.TabStop = false;
this.picSignIn.Click += new System.EventHandler(this.pictureBox1_Click);
//
// btnSubmit
//
this.btnSubmit.BackgroundImage = global::Taki_Client.Properties.Resources.Submit_Button;
this.btnSubmit.Location = new System.Drawing.Point(314, 347);
this.btnSubmit.Name = "btnSubmit";
this.btnSubmit.Size = new System.Drawing.Size(157, 57);
this.btnSubmit.TabIndex = 5;
this.btnSubmit.UseVisualStyleBackColor = true;
this.btnSubmit.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnSubmit_MouseClick);
//
// tbUsername
//
this.tbUsername.BackColor = System.Drawing.SystemColors.HotTrack;
this.tbUsername.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177)));
this.tbUsername.ForeColor = System.Drawing.SystemColors.Menu;
this.tbUsername.Location = new System.Drawing.Point(314, 223);
this.tbUsername.Multiline = true;
this.tbUsername.Name = "tbUsername";
this.tbUsername.Size = new System.Drawing.Size(201, 44);
this.tbUsername.TabIndex = 6;
this.tbUsername.Text = "Username";
//
// tbPassword
//
this.tbPassword.BackColor = System.Drawing.SystemColors.HotTrack;
this.tbPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177)));
this.tbPassword.ForeColor = System.Drawing.SystemColors.Menu;
this.tbPassword.Location = new System.Drawing.Point(314, 284);
this.tbPassword.Multiline = true;
this.tbPassword.Name = "tbPassword";
this.tbPassword.Size = new System.Drawing.Size(201, 44);
this.tbPassword.TabIndex = 7;
this.tbPassword.Text = "Password";
//
// SignIn
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.BackgroundImage = global::Taki_Client.Properties.Resources.Taki_main_screen;
this.ClientSize = new System.Drawing.Size(804, 611);
this.Controls.Add(this.tbPassword);
this.Controls.Add(this.tbUsername);
this.Controls.Add(this.btnSubmit);
this.Controls.Add(this.btnMenu);
this.Controls.Add(this.picSignIn);
this.Name = "SignIn";
this.Text = "Taki Client";
this.TransparencyKey = System.Drawing.Color.Transparent;
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.picSignIn)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox picSignIn;
private System.Windows.Forms.Button btnMenu;
private System.Windows.Forms.Button btnSubmit;
private System.Windows.Forms.TextBox tbUsername;
private System.Windows.Forms.TextBox tbPassword;
}
}
By setting the TransparencyKey of the form, transparency is enabled. Default color for transparency is white.
Remove this line from the InitializeComponent () function
this.TransparencyKey = System.Drawing.Color.Transparent;
and the white on your form will no longer be transparent.

Categories

Resources