C
C#3w ago
Ale

when I want to enter to open my path, the click event is activated

this is the code https://paste.ofcode.org/t3AqXpwPMuULScQt7vNkXF I do not know what to do
No description
31 Replies
Somgör from Human Resources
You should totally use Dapper.
TheRanger
TheRanger3w ago
i suggest Entity Framework anyway im not sure what ur talking about, can u provide more details?
Ale
Ale3w ago
what is this? So I have a form that has 3 buttons, each button sits in the groupbox a panel with various buttons that are created by hand in the code. I want a path to open when I press enter. So, with the help of the arrows, I want to go through those buttons in the panel and when I press enter, that path will open. I managed to implement, I say, but when I press enter, the click event is activated. When I press enter, I want the path to the file to open. The file paths are stored in the database.
Somgör from Human Resources
It allows you to map SQL query results to objects But the more modern approach is using EF Core
TheRanger
TheRanger3w ago
what click event, where is it in ur code?
Ale
Ale3w ago
it's a separate method
TheRanger
TheRanger3w ago
well, hard to help without knowing what method is it calling
Ale
Ale3w ago
https://paste.ofcode.org/apFHHdSg7hg88uu8LJK6vR i put the method this is the click event when I press enter on the button, what should appear when I press click appears
TheRanger
TheRanger3w ago
Button_Click ?
Ale
Ale3w ago
yes but I don't want this to appear when I press enter
TheRanger
TheRanger3w ago
was the button focused when u pressed enter?
Ale
Ale3w ago
yes selectedIndex = 0; booksPhilosophy[selectedIndex].Focus();
TheRanger
TheRanger3w ago
what do u want to appear when u press enter then?
Ale
Ale3w ago
to run the path
TheRanger
TheRanger3w ago
so you want the button to call button_click method if clicked by mouse, and run the path if pressed enter on it?
Ale
Ale3w ago
yess
TheRanger
TheRanger3w ago
why not just create a different button idk if this is possible, might need to look it up
Ale
Ale3w ago
button for ??
TheRanger
TheRanger3w ago
to run the path
Ale
Ale3w ago
in the panel there are several buttons that would represent the cover of a book and not just one button probably what I want is impossible but I don't understand why
TheRanger
TheRanger3w ago
well try something like this
else if (e.KeyCode == Keys.Enter && yourbutton.Focused)
{
OpenBookPath();
}
else if (e.KeyCode == Keys.Enter && yourbutton.Focused)
{
OpenBookPath();
}
in ur BooksInEnglish_KeyDown method
Ale
Ale3w ago
looks the same as before private void BooksInEnglish_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Right) { NavigateButtons(1); } else if (e.KeyCode == Keys.Left) { NavigateButtons(-1); } else if (e.KeyCode == Keys.Enter && buttonPsychology1.Focused) { OpenBookPath(); }
}
TheRanger
TheRanger3w ago
did it work?
Ale
Ale3w ago
nope :Smadge: i don't know what to do can you help me what to do about this
TheRanger
TheRanger3w ago
or MouseDown
SparkyCracked
SparkyCracked2w ago
@Ale did this work?
Ale
Ale2w ago
nope I managed in the end, I made a separate button that deals with this and it s work new
SparkyCracked
SparkyCracked2w ago
Ok sick, still wanna see if there is a way to do what you wanted but will do so in my own free time
Ale
Ale2w ago
if you manage to solve it, please tell me how you did it
SparkyCracked
SparkyCracked2w ago
Will do