Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
Export Error Handling when trying to import null data
Browse files Browse the repository at this point in the history
  • Loading branch information
VoxDroid committed Dec 22, 2023
1 parent 6fa1867 commit f016b32
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Pages/Export.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,25 @@ private void EnableExportButton()

private void exportbutton_Click(object sender, EventArgs e)
{

if (guna2ComboBox2.SelectedIndex == 1 && budmangrid.Rows.Count == 0)
{
MessageBox.Show("No data to export.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

if (guna2ComboBox2.SelectedIndex == 2 && budmangrid2.Rows.Count == 0)
{
MessageBox.Show("No data to export.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

if (guna2ComboBox2.SelectedIndex == 3 && budmangrid3.Rows.Count == 0)
{
MessageBox.Show("No data to export.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

if (guna2ComboBox2.SelectedIndex < 1 || guna2ComboBox1.SelectedIndex < 1)
{
MessageBox.Show("Please select both a table and a format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Expand Down Expand Up @@ -456,6 +475,8 @@ private void ExportData(DataGridView dataGridView, string filePath, string forma
{
try
{


switch (format.ToLower())
{
case "csv":
Expand Down

0 comments on commit f016b32

Please sign in to comment.