0% found this document useful (0 votes)
2 views

source code

The document outlines the implementation of a DashboardForm for a Farm Management System in C#. It includes features such as welcoming the user, managing crops and livestock, generating reports, and logging out. The form is designed with buttons for each functionality and utilizes event handlers to manage user interactions.

Uploaded by

harowntowett
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

source code

The document outlines the implementation of a DashboardForm for a Farm Management System in C#. It includes features such as welcoming the user, managing crops and livestock, generating reports, and logging out. The form is designed with buttons for each functionality and utilizes event handlers to manage user interactions.

Uploaded by

harowntowett
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

dasboard form

using System;
using System.Windows.Forms;

namespace FarmManagementSystem
{
public partial class DashboardForm : Form
{
private string _username;

public DashboardForm(string username)


{
InitializeComponent();
_username = username;
lblWelcome.Text = $"Welcome, {_username}!";
}

private void btnCropManagement_Click(object sender, EventArgs e)


{
// Open Crop Management form
CropManagementForm cropForm = new CropManagementForm();
cropForm.ShowDialog(); // Use Show() if you want non-modal
}

private void btnLivestock_Click(object sender, EventArgs e)


{
// Open Livestock Management form
LivestockForm livestockForm = new LivestockForm();
LivestockForm.ShowDialog(); // Use Show() if you want non-modal
}

private void btnReports_Click(object sender, EventArgs e)


{
MessageBox.Show("Navigate to Reports Module", "Info");
// TODO: Open Reports form
}

private void btnLogout_Click(object sender, EventArgs e)


{
var confirm = MessageBox.Show("Are you sure you want to logout?",
"Confirm Logout", MessageBoxButtons.YesNo);
if (confirm == DialogResult.Yes)
{
this.Close();
// Optionally, show login form again
}
}
}

internal class LivestockManagementForm


{
}
}
dashboarddesigner

using System.Windows.Forms;

namespace FarmManagementSystem
{
partial class DashboardForm
{
private System.ComponentModel.IContainer components = null;
private Label lblWelcome;
private System.Windows.Forms.Button btnCropManagement;
private System.Windows.Forms.Button btnLivestock;
private Button btnReports;
private Button btnLogout;

protected override void Dispose(bool disposing)


{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblWelcome = new System.Windows.Forms.Label();
this.btnCropManagement = new System.Windows.Forms.Button();
this.btnLivestock = new System.Windows.Forms.Button();
this.btnReports = new System.Windows.Forms.Button();
this.btnLogout = new System.Windows.Forms.Button();
this.btnCrop = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblWelcome
//
this.lblWelcome.Font = new System.Drawing.Font("Segoe UI", 14F,
System.Drawing.FontStyle.Bold);
this.lblWelcome.Location = new System.Drawing.Point(12, 20);
this.lblWelcome.Name = "lblWelcome";
this.lblWelcome.Size = new System.Drawing.Size(360, 30);
this.lblWelcome.TabIndex = 0;
this.lblWelcome.Text = "Welcome, User!";
this.lblWelcome.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// btnCropManagement
//
this.btnCropManagement.Location = new System.Drawing.Point(50, 70);
this.btnCropManagement.Name = "btnCropManagement";
this.btnCropManagement.Size = new System.Drawing.Size(0, 0);
this.btnCropManagement.TabIndex = 0;
this.btnCropManagement.Text = "Crop Management";
this.btnCropManagement.UseVisualStyleBackColor = true;
this.btnCropManagement.Click += new
System.EventHandler(this.btnCropManagement_Click);
//
// btnLivestock
//
this.btnLivestock.Location = new System.Drawing.Point(50, 120);
this.btnLivestock.Name = "btnLivestock";
this.btnLivestock.Size = new System.Drawing.Size(280, 40);
this.btnLivestock.TabIndex = 2;
this.btnLivestock.Text = "Livestock Management";
this.btnLivestock.UseVisualStyleBackColor = true;
this.btnLivestock.Click += new
System.EventHandler(this.btnLivestock_Click);
//
// btnReports
//
this.btnReports.Location = new System.Drawing.Point(50, 170);
this.btnReports.Name = "btnReports";
this.btnReports.Size = new System.Drawing.Size(280, 40);
this.btnReports.TabIndex = 3;
this.btnReports.Text = "Reports";
this.btnReports.UseVisualStyleBackColor = true;
this.btnReports.Click += new
System.EventHandler(this.btnReports_Click);
//
// btnLogout
//
this.btnLogout.Location = new System.Drawing.Point(50, 220);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(280, 40);
this.btnLogout.TabIndex = 4;
this.btnLogout.Text = "Logout";
this.btnLogout.UseVisualStyleBackColor = true;
this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
//
// btnCrop
//
this.btnCrop.Location = new System.Drawing.Point(50, 70);
this.btnCrop.Name = "btnCrop";
this.btnCrop.Size = new System.Drawing.Size(280, 40);
this.btnCrop.TabIndex = 1;
this.btnCrop.Text = "Crop Management";
this.btnCrop.UseVisualStyleBackColor = true;
//
// DashboardForm
//
this.ClientSize = new System.Drawing.Size(384, 291);
this.Controls.Add(this.btnCrop);
this.Controls.Add(this.btnLogout);
this.Controls.Add(this.btnReports);
this.Controls.Add(this.btnLivestock);
this.Controls.Add(this.btnCropManagement);
this.Controls.Add(this.lblWelcome);
this.FormBorderStyle =
System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "DashboardForm";
this.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScreen;
this.ResumeLayout(false);
}

private System.Windows.Forms.Button btnCrop;


}
}

using System.Windows.Forms;

namespace FarmManagementSystem
{
partial class DashboardForm
{
private System.ComponentModel.IContainer components = null;
private Label lblWelcome;
private System.Windows.Forms.Button btnCropManagement;
private System.Windows.Forms.Button btnLivestock;
private Button btnReports;
private Button btnLogout;

protected override void Dispose(bool disposing)


{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblWelcome = new System.Windows.Forms.Label();
this.btnCropManagement = new System.Windows.Forms.Button();
this.btnLivestock = new System.Windows.Forms.Button();
this.btnReports = new System.Windows.Forms.Button();
this.btnLogout = new System.Windows.Forms.Button();
this.btnCrop = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblWelcome
//
this.lblWelcome.Font = new System.Drawing.Font("Segoe UI", 14F,
System.Drawing.FontStyle.Bold);
this.lblWelcome.Location = new System.Drawing.Point(12, 20);
this.lblWelcome.Name = "lblWelcome";
this.lblWelcome.Size = new System.Drawing.Size(360, 30);
this.lblWelcome.TabIndex = 0;
this.lblWelcome.Text = "Welcome, User!";
this.lblWelcome.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// btnCropManagement
//
this.btnCropManagement.Location = new System.Drawing.Point(50, 70);
this.btnCropManagement.Name = "btnCropManagement";
this.btnCropManagement.Size = new System.Drawing.Size(0, 0);
this.btnCropManagement.TabIndex = 0;
this.btnCropManagement.Text = "Crop Management";
this.btnCropManagement.UseVisualStyleBackColor = true;
this.btnCropManagement.Click += new
System.EventHandler(this.btnCropManagement_Click);
//
// btnLivestock
//
this.btnLivestock.Location = new System.Drawing.Point(50, 120);
this.btnLivestock.Name = "btnLivestock";
this.btnLivestock.Size = new System.Drawing.Size(280, 40);
this.btnLivestock.TabIndex = 2;
this.btnLivestock.Text = "Livestock Management";
this.btnLivestock.UseVisualStyleBackColor = true;
this.btnLivestock.Click += new
System.EventHandler(this.btnLivestock_Click);
//
// btnReports
//
this.btnReports.Location = new System.Drawing.Point(50, 170);
this.btnReports.Name = "btnReports";
this.btnReports.Size = new System.Drawing.Size(280, 40);
this.btnReports.TabIndex = 3;
this.btnReports.Text = "Reports";
this.btnReports.UseVisualStyleBackColor = true;
this.btnReports.Click += new
System.EventHandler(this.btnReports_Click);
//
// btnLogout
//
this.btnLogout.Location = new System.Drawing.Point(50, 220);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(280, 40);
this.btnLogout.TabIndex = 4;
this.btnLogout.Text = "Logout";
this.btnLogout.UseVisualStyleBackColor = true;
this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
//
// btnCrop
//
this.btnCrop.Location = new System.Drawing.Point(50, 70);
this.btnCrop.Name = "btnCrop";
this.btnCrop.Size = new System.Drawing.Size(280, 40);
this.btnCrop.TabIndex = 1;
this.btnCrop.Text = "Crop Management";
this.btnCrop.UseVisualStyleBackColor = true;
//
// DashboardForm
//
this.ClientSize = new System.Drawing.Size(384, 291);
this.Controls.Add(this.btnCrop);
this.Controls.Add(this.btnLogout);
this.Controls.Add(this.btnReports);
this.Controls.Add(this.btnLivestock);
this.Controls.Add(this.btnCropManagement);
this.Controls.Add(this.lblWelcome);
this.FormBorderStyle =
System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "DashboardForm";
this.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScreen;
this.ResumeLayout(false);
}

private System.Windows.Forms.Button btnCrop;


}
}

private void btnCropManagement_Click(object sender, EventArgs e)


{
// Open Crop Management form
CropForm CropForm = new CropForm();
CropForm.ShowDialog(); // Use Show() if you want non-modal
}

private void btnLivestock_Click(object sender, EventArgs e)


{
// Open Livestock Management form
LivestockForm livestockForm = new LivestockForm();
LivestockForm.ShowDialog(); // Use Show() if you want non-modal
}

You might also like