Reputation: 1
Description: I'm developing a C# WinForms application using Visual Studio 2022, .net6.0-windows, Visual Studio Version: 17.12.4, I created the form and wrote the code. Everything was fine at first, but after some time, when I tried to run the program, I encountered an error in the following code that assigns text to a menu button in one of my MenuStrip controls:
menuStrip_Bilgi.Text = DegisiklikOldu ? "Changes made!!!" : "No changes!!!";
The error message was: "menuStrip_Bilgi not found."
When I went back to the form design view, I noticed that menuStrip_Bilgi was indeed missing. However, its parent, menuStrip_Takvim_Ust_Bilgi, was still there. Then I realized that all the MenuStrip controls and their MenuItem controls were missing from the design view. In the Form1.Designer.cs file, I saw that only the MenuStrip itself was defined, but all the MenuItem controls were completely gone.
After some time, I also noticed that all ContextMenuStrip and StatusStrip controls had disappeared. In Form1.Designer.cs, I only found the following declarations:
private StatusStrip statusStrip_Alt_Bilgi;
private MenuStrip menuStrip_Ust_Bilgi;
But their content was completely empty. I thought it was my mistake and re-added the items manually to temporarily fix the issue. However, the same thing happened again a day later: all MenuStrip and StatusStrip items disappeared, and the ContextMenuStrip controls at the bottom of the form were gone as well. In Form1.Designer.cs, they were still listed by name, but their contents were completely missing.
This issue keeps recurring, and it's severely affecting my project, which was almost finished. What is causing this problem, and how can I fix it? Any help would be greatly appreciated![enter image description here][1]
https://hizliresim.com/lcus5tc
Items that were deleted from my form's design screen but are still in the designer:
private ToolStripMenuItem Context_Kisiler_Kisi_Sil;
private ToolStripMenuItem Context_Kisiler_Kisi_Duzenle;
private ToolStripMenuItem Context_Kisiler_Kisi_Ekle;
private StatusStrip statusStrip_Alt_Bilgi;
private ToolStripStatusLabel statusStrip_Linkim;
private MenuStrip menuStrip_Ust_Bilgi;
private ToolStripMenuItem menuStrip_ReStart;
private ToolStripMenuItem menuStrip_Kisi_Bilgilerini_Kaydet;
private ToolStripMenuItem menuStrip_Kisi_Bilgilerini_Tekrar_Oku;
private ToolStripMenuItem menuStrip_Iletisim;
private MenuStrip menuStrip_Takvim_Ust_Bilgi;
private ToolStripMenuItem menuStrip_Bilgi;
private ToolStripMenuItem ToolStripMenuItem_Takvim_Aralik_Disi_Tarih;
private ToolStripMenuItem ToolStripMenuItem_Takvim_Nobet_Eksik_Tarih;
private ToolStripMenuItem ToolStripMenuItem_Takvim_Nobet_Tamam_Tarih;
private ContextMenuStrip contextMenuStrip_SiralamaListesi;
private ToolStripMenuItem ToolStripMenuItem_NobetleriSifirma;
private ToolStripMenuItem ToolStripMenuItem_HaftaIciNobetleriSifirla;
private ToolStripMenuItem ToolStripMenuItem_HaftaSonuNobetleriSifirla;
private ToolStripMenuItem ToolStripMenuItem_TumNobetleriSifirla;
private ToolStripMenuItem tumKisilerIcinNobetleriSifirlaToolStripMenuItem;
private ToolStripMenuItem toolStripMenuItem_TumKisiler_HaftaIci_Sifirla;
private ToolStripMenuItem toolStripMenuItem_TumKisiler_HaftaSonu_Sifirla;
private ToolStripMenuItem toolStripMenuItem_TumKisiler_TumNobetleri_Sifirla;
private ToolStripMenuItem ToolStripMenuItem_TakvimdenGeriAl;
private ToolStripMenuItem toolStripMenuItem_NobetleriSifirma_Bu_Kisiyi_Geri_AL;
private ToolStripMenuItem toolStripMenuItem_NobetleriSifirma_Herkesi_Geri_AL;
private ToolStripMenuItem ToolStripMenuItem_Nobetle;
private ContextMenuStrip contextMenuStrip_Takvim;
private ToolStripMenuItem ToolStripMenuItem_Takvim_Bu_Tarih_Nobetleri_Temizle;
private ToolStripMenuItem ToolStripMenuItem_Takvim_Tum_Takvim_Nobetleri_Temizle;
private ToolStripMenuItem ToolStripMenuItem_Takvim_Bu_Tarih_Nobetleri_Duzenle;
private ContextMenuStrip contextMenuStrip_TakvimTarihKisiSil;
private ToolStripMenuItem ToolStripMenuItem_Takvim_Hucre_KisiSil;
it's my designer.cs
namespace NobetListesiOlusuturucu
{
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()
{
components = new System.ComponentModel.Container();
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
dataGridView_KisiListesi = new DataGridView();
Column_No = new DataGridViewTextBoxColumn();
FullName = new DataGridViewTextBoxColumn();
Unit = new DataGridViewTextBoxColumn();
Rank = new DataGridViewTextBoxColumn();
Column_BirlikteCalisabilecegiKisiler = new DataGridViewTextBoxColumn();
Column_BirlikteCalisamayacagiKisiler = new DataGridViewTextBoxColumn();
Column_CaslisamayacagiGunler = new DataGridViewTextBoxColumn();
panel1 = new Panel();
button_dataGridView_KisiListesi_Guncelle = new Button();
...It continues like this
If you want to see full designer.cs code: https://justpaste.it/9p2bg
Upvotes: 0
Views: 98