C
C#6mo 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
The Fog from Human Resources
You should totally use Dapper.
TheRanger
TheRanger6mo ago
i suggest Entity Framework anyway im not sure what ur talking about, can u provide more details?
Ale
AleOP6mo 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.
The Fog from Human Resources
It allows you to map SQL query results to objects But the more modern approach is using EF Core
TheRanger
TheRanger6mo ago
what click event, where is it in ur code?
Ale
AleOP6mo ago
it's a separate method
TheRanger
TheRanger6mo ago
well, hard to help without knowing what method is it calling
Ale
AleOP6mo 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
TheRanger6mo ago
Button_Click ?
Ale
AleOP6mo ago
yes but I don't want this to appear when I press enter
TheRanger
TheRanger6mo ago
was the button focused when u pressed enter?
Ale
AleOP6mo ago
yes selectedIndex = 0; booksPhilosophy[selectedIndex].Focus();
TheRanger
TheRanger6mo ago
what do u want to appear when u press enter then?
Ale
AleOP6mo ago
to run the path
TheRanger
TheRanger6mo 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
AleOP6mo ago
yess
TheRanger
TheRanger6mo ago
why not just create a different button idk if this is possible, might need to look it up
Ale
AleOP6mo ago
button for ??
TheRanger
TheRanger6mo ago
to run the path
Ale
AleOP6mo 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
TheRanger6mo 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
AleOP6mo 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
TheRanger6mo ago
did it work?
Ale
AleOP6mo ago
nope :Smadge: i don't know what to do can you help me what to do about this
TheRanger
TheRanger6mo ago
or MouseDown
SparkyCracked
SparkyCracked6mo ago
@Ale did this work?
Ale
AleOP6mo ago
nope I managed in the end, I made a separate button that deals with this and it s work new
SparkyCracked
SparkyCracked6mo 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
AleOP6mo ago
if you manage to solve it, please tell me how you did it
SparkyCracked
SparkyCracked6mo ago
Will do
Want results from more Discord servers?
Add your server