C
C#11mo ago
5124

Visual Studio 2022 winforms problem

Eror: CS1061
private void btn_Giris_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_KullaniciAdi.Text))
{

using (WisdifyData data = new WisdifyData())
{
Kullanici kullanici = data.kullaniciAl(txt_KullaniciAdi.Text);

if (kullanici != null)
{
Menu me = new Menu(kullanici); // ### Problemm CS0144
me.Show(); // ### Problemm CS1061

}
else
{
MessageBox.Show("Kullanıcı adına sahip bir kişi bulunamadı.", "Bulunamadı", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
else
{
MessageBox.Show("Lütfen boş bırakmayınız.","Uyarı",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private void btn_Giris_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txt_KullaniciAdi.Text))
{

using (WisdifyData data = new WisdifyData())
{
Kullanici kullanici = data.kullaniciAl(txt_KullaniciAdi.Text);

if (kullanici != null)
{
Menu me = new Menu(kullanici); // ### Problemm CS0144
me.Show(); // ### Problemm CS1061

}
else
{
MessageBox.Show("Kullanıcı adına sahip bir kişi bulunamadı.", "Bulunamadı", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
else
{
MessageBox.Show("Lütfen boş bırakmayınız.","Uyarı",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
I wrote the error code numbers in the code, I couldn't find a solution
14 Replies
Angius
Angius11mo ago
I don't remember all error codes by hearth. I don't think anybody does, actually So what are CS0144 and CS1061?
5124
5124OP11mo ago
Excuse me, you wouldn't understand it even if I threw it because my IDE is in Turkish, now I'm sending the official error message: CS1061 : 'type' does not contain a definition for 'name' and no accessible extension method 'name' accepting a first argument of type 'type' could be found (are you missing a using directive or an assembly reference?). CS0144 : Cannot create an instance of the abstract class or interface 'interface'
Angius
Angius11mo ago
They seem pretty obvious Menu is an abstract class or an interface, and those cannot be instantiated And whatever Menu is, it has no method named Show()
5124
5124OP11mo ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Wisdify.Sınıflar;

namespace Wisdify.Formlar
{
public partial class Menu : Form
{
Kullanici kullanici;
public Menu( Kullanici _kullanici)
{
InitializeComponent();
kullanici = _kullanici;
}

private void Menu_Load(object sender, EventArgs e)
{

}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Wisdify.Sınıflar;

namespace Wisdify.Formlar
{
public partial class Menu : Form
{
Kullanici kullanici;
public Menu( Kullanici _kullanici)
{
InitializeComponent();
kullanici = _kullanici;
}

private void Menu_Load(object sender, EventArgs e)
{

}
}
}
menu.cs (form) I didn't understand the menu I created as a Windows form and I didn't understand why the error was caused by everything is correct from my point of view but I don't know I must have a small mistake somewhere, when I opened another form for the experiment, it worked fine before I took any form settings, unfortunately the errors did not leave me when I came back to this project
Angius
Angius11mo ago
Why is it partial? It could be that another partial Menu class exists, and this one is abstract So in total you get an abstract Menu class
MODiX
MODiX11mo ago
Angius
REPL Result: Failure
// This hides somewhere in your project
abstract partial class Menu { }

// This is what you showed above
partial class Menu { }

// Which makes the whole thing abstract and thus, impossible to instantiate
new Menu();
// This hides somewhere in your project
abstract partial class Menu { }

// This is what you showed above
partial class Menu { }

// Which makes the whole thing abstract and thus, impossible to instantiate
new Menu();
Exception: CompilationErrorException
- Cannot create an instance of the abstract type or interface 'Menu'
- Cannot create an instance of the abstract type or interface 'Menu'
Compile: 233.367ms | Execution: 0.000ms | React with ❌ to remove this embed.
5124
5124OP11mo ago
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Shouldn't it be partial, it's a winform, and as far as I know, all forms are partial.
Angius
Angius11mo ago
Are they? Never worked much with Winforms so maybe
5124
5124OP11mo ago
Yes, they are all partisan
Angius
Angius11mo ago
No idea, then
5124
5124OP11mo ago
😦 My friend, I solved it, at the end of 2 days, it turns out that with the new update, there is a feature called Menu, a class called Visual A Menu has come, so the two overlap @ZZZZZZZZZZZZZZZZZZZZZZZZZ
Angius
Angius11mo ago
Ah, makes sense Glad you solved it!
abdulrauf6514
abdulrauf651410mo ago
how to upgrade visual studio 2017 to 2022 i have 2022 in my other laptop but in this machine i have windows 10 and vs 2017 version.
Angius
Angius10mo ago
Just uninstall 2017 and install 2022 Or just install 2022, they can exist besides eachother
Want results from more Discord servers?
Add your server