Windows Forms help needed
Hey guys! I'm building a school project in C# using Windows Forms. I really need some help in plenty of things. I'm completely unfamiliar with this.
Here is the Form itself
How do I achieve so if I choose a different menuitem on the top the context of the page changes? so for example if I click the 2nd option "Munkalap" the background is no longer visible but rather I can add new handles that I want on that page
if someone is experienced in windows forms I would greatly appreciate if you'd hit me up or in general anyone answering here:)
29 Replies
I recommend using a tab control instead of a menu strip for that page change idea.
It automatically handles that for you.
Thank you so much
Decided to stick with ToolStripMenuItem because that's what my prof asked for.
When I press the second option "Munkalap" something like this should pop up
how can I achieve this?
for context: This is a car mechanic workshop and this page accumulated the total costs for repair
are all the menu items, supposed to open new windows like this?
because thats not "changing the page" as you previously asked for
yes, that's right
I didn't examine closely but all of them are supposed to open like this in new windows
okay
each window (aka Form in winforms) will be its own class
so when the button is clicked, you just create a variable for that form, instantiate it with the construtor, then call the
.ShowDialog()
method on the formsomething like this?
yes now I have the new windows popping up
but how exactly do I put stuff in them to make it like this?
by putting things in them?
just as you did with your main form
yeah right, thank you
@Pobiega sorry for the ping, hope I don't bother you but could you please guide me a bit further?
The goal is to get the "Munkalap" (you could call it "Worksheet") form to show the content of a Txt file that look something like this:
`
SzámÃtógépes hibakeresés;10;0
Téli/Nyári kerékcsere;30;0
Ë™
in columns
columns are separated with ";".
Whenever I try to run the code everything works just fine but when I try to open the Worksheet form it doesn't show anything.
here is the Worksheet method for dataloadand this is what I would like to achieve
well, what you want to achieve certainly doesnt use a listbox
in fact, it seems to use dynamically added controls of some sorts
are they labels?
looks like it, yes
and then there is a checkbox
Can I update labels based on the txt file I provide?
I want the labels to show up only that are in my txt file
yeah, but it will be a mess
I suggest you create a user control
I’ll look into that thanks
then you can make something like this
in this case I add them when you click the button, but it could easily be from a file instead
to clarify, I created a user control that has 4 labels and a checkbox in it, all spaced up the way you want. When the button is clicked, a new usercontrol is instantiated and added to a
FlowLayoutPanel
sounds like a good idea
could you share your code please?
No.
That would be cheating.
I already spoonfed you a solution, but the implementation is up to you
Fair play
Thanks for your help
Just to be clear, this doesnt mean you wont get more help here, I just won't hand you the code. If you get stuck, feel free to ask for more help
Appreciate you! I'll ask whenever I need