C
C#3mo ago
Falco

MainWindow' does not contain a definition for 'Button_Click'

Why is this occuring? Even if I delete the method in my code, and the xalm code for the button, the error is still there. Even if I rebuild/save/restart my project. Things I've already tried which should solve it according to the internet: - Make sure namespace matches Xaml and in code(Both have EpicUnfriender) - I deleted bin/obj and restarted project - Deleted both xalm code for the button, and method Button_Click but error still occurs Code:
using System.Windows;
using System.Windows.Input;
using NHotkey.Wpf;
using NHotkey;

namespace EpicUnfriender
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();;
}
// StartButton
public void Button_Click(object sender, RoutedEventArgs e){}
}
}
using System.Windows;
using System.Windows.Input;
using NHotkey.Wpf;
using NHotkey;

namespace EpicUnfriender
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();;
}
// StartButton
public void Button_Click(object sender, RoutedEventArgs e){}
}
}
No description
8 Replies
Falco
Falco3mo ago
My xaml code:
<Window x:Class="EpicUnfriender.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EpicUnfriender"
mc:Ignorable="d"
Title="MainWindow" Height="242" Width="375" ResizeMode="NoResize">
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox x:Name="LogBox" HorizontalAlignment="Center" VerticalAlignment="Center" Width="365" Height="140
" Grid.Row="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Background="Black" Foreground="White" TextWrapping="WrapWithOverflow"/>
<Button x:Name="Start" Content="Start (F8)" HorizontalAlignment="center" Height="21" VerticalAlignment="Center" Width="73" BorderBrush="#FFC35151" Click="Button_Click" Background="#FFF5F5FF" Grid.Row="2" />
<Button x:Name="Stop" Content="Stop (F9)" HorizontalAlignment="center" Height="21" VerticalAlignment="Center" Width="73" Background="#FFF3F3F3" BorderBrush="#FFC35151" Grid.Column="2" Grid.Row="2" Click="Stop_Click"/>
</Grid>
</Window>
<Window x:Class="EpicUnfriender.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EpicUnfriender"
mc:Ignorable="d"
Title="MainWindow" Height="242" Width="375" ResizeMode="NoResize">
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox x:Name="LogBox" HorizontalAlignment="Center" VerticalAlignment="Center" Width="365" Height="140
" Grid.Row="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Background="Black" Foreground="White" TextWrapping="WrapWithOverflow"/>
<Button x:Name="Start" Content="Start (F8)" HorizontalAlignment="center" Height="21" VerticalAlignment="Center" Width="73" BorderBrush="#FFC35151" Click="Button_Click" Background="#FFF5F5FF" Grid.Row="2" />
<Button x:Name="Stop" Content="Stop (F9)" HorizontalAlignment="center" Height="21" VerticalAlignment="Center" Width="73" Background="#FFF3F3F3" BorderBrush="#FFC35151" Grid.Column="2" Grid.Row="2" Click="Stop_Click"/>
</Grid>
</Window>
Even after I delete all the buttons and the method the error still remains wtf ?
Buddy
Buddy3mo ago
Why do you need a program that unfriends on epic?
Falco
Falco3mo ago
What is Epic? I dont understand what you mean
Buddy
Buddy3mo ago
Your program is called "EpicUnfriender" I assume it is for Epic Games
Jimmacle
Jimmacle3mo ago
now we know what the UI automation question was about it wasn't for feet pics after all! @Falco is this kind of automation within epic's TOS?
Falco
Falco3mo ago
I don't know what Epic Games is... I'm not automating any game It's EpicUnfriender because nobody would want to be friends anymore with me after they know what I'm doing Any tips on my project though? Tried everything nothing works Someone said they had to restart a new project and the problem was gone But maybe there is something I'm not seeing
Jimmacle
Jimmacle3mo ago
considering i don't know whether your project is legit or not anymore, not really
Falco
Falco3mo ago
Well maybe if you read what I said you'd know But nevermind xd