Ошибка System.IO.FileNotFoundException: 'C:\Users\Asl\source\repos\TwelveMonths\TwelveMonths\bin\Debug\net8.0-windows\1.jpg'
Почему появляется ошибка System.IO.FileNotFoundException: 'C:\Users\Asl\source\repos\TwelveMonths\TwelveMonths\bin\Debug\net8.0-windows\1.jpg'
откуда компилятор вообще находит 1.jpg, у меня она где-то упоминается ?
namespace TwelveMonths
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
showMonthPicture();
}
private void monthCalendar_DateChanged(object sender, DateRangeEventArgs e)
{
showMonthPicture();
}
private void showMonthPicture()
{
string month = monthCalendar.SelectionStart.Month.ToString();
pictureBox.Image = Image.FromFile($"");
}
}
}
Я не понимаю почему ищется файл 1.jpg
я же ведь даже не прописывал.
КОД ДИЗАЙНЕРА:
namespace TwelveMonths
{
partial class Form1
{
/// <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(Form1));
monthCalendar = new MonthCalendar();
pictureBox = new PictureBox();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
SuspendLayout();
//
// monthCalendar
//
monthCalendar.Location = new Point(5, 9);
monthCalendar.MaxSelectionCount = 1;
monthCalendar.Name = "monthCalendar";
monthCalendar.TabIndex = 0;
monthCalendar.DateChanged += monthCalendar_DateChanged;
//
// pictureBox
//
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(800, 450);
pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(monthCalendar);
Controls.Add(pictureBox);
Icon = (Icon)resources.GetObject("$this.Icon");
Name = "Form1";
StartPosition = FormStartPosition.CenterScreen;
Text = "12 месяцов";
WindowState = FormWindowState.Maximized;
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private MonthCalendar monthCalendar;
private PictureBox pictureBox;
}
}