88 Replies
$newproject
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework.
.NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended.
https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Please do not select anything that says ".NET Framework"
1. Create a program where the user can add and remove elements from a listBox object.
2. Make a program with a PictureBox that changes the picture according to which of three RadioButtons the user has selected.
3. Create a Windows Forms project that contains a webBrowser object. Use the .Navigate method to navigate to a url.
Ok
How come? Is it outdated or something?
come on man
You've been here for almost a year now
Let me delete the project then and create a new one but this time without a .NET Framework
surely you must have picked up on the fact that .net framework is indeed very old and outdated at this point
Ok!
Now, I'm aware of that and surely, I won't think about using it at all.
Which one should I use then?
this one
since your post title clearly says "windows forms", not "WPF"
Ok! Awesome. Thanks a lot.
May, I know why you prefer WPF?
winforms is very very old
Ok
it uses an outdated imperative approach to UIs, while WPF is more declarative
Aha! Ok!
doesnt matter thou, your course says to use winforms
so use winforms
But none of the options in my screenshots corresponds to this one?
.
Yeah! I'll just follow the course requirements for now.
All of them are Framework
I dunno, seems you only get framework suggestions. Did you check the "Desktop development" workload when you installed Visual Studio?
I don't remember to be honest with you
What would be the alternative do you think?
there are no alternatives
you cant substitute the correct project type for another lol
so close down visual studio, start the VS installer and check what workloads you have
Should I click here and maybe reinstall Winforms?
Ok
you need this one.
Ok
Awesome. It's installed now.
Yahhhee
there you go
Should I use .NET 6.0 or 7.0?
Yep
7.0
Great
This time, I'm not able to reach to the toolbox.
have you tried opening the toolbox?
its under
View
I found it, thanks a lot.
Now. it's time apply these.
yes.
How do I edit the label to "Add"?
click the label
then edit the property, as you tried doing
but you need to have the label selected, not the form itself
you can also select it here
Ok
I wonder what the label its roll is?
I'm following this tutorial https://www.youtube.com/watch?v=nnLfYu5jEXM&t=170s
Haritha Computers & Technology
YouTube
How To Add Remove Items In Listbox Dynamically Winforms c#4.6
#listbox #addremovelistbos #dynamicallylistboxitems
add and remove items from the listbox control from textbox dynamically in windows application winforms
Label
is just for showing text
thats itOk! But I could've edit my buttons text to
Add
and Remove
why would I need a label too?because not everything is a button?
No
I have a listBox and textBox
for example, if you have 3 textboxes next to eachother
Yes
it might be useful to label them, so the user knows what goes in what box
Ok
Now I see why we need to use it
How do I get rid of this and go back to my UI window?
This appeared after making a change in the code
you added an event binding then removed the code for the event handler
you'll need to edit the designer file
As the guy above me said, you added a control Event handler then u removed and now u need to go on Solution Explorer, open the arrow (dropdown) of your Form an then go on Form1.Designer.cs, after that u will need to find a metho named InitializeComponent(), Go inside of it and find the code line that has a Red Curl and erase that line.
Ok! Thanks a lot for showing up and identifying where the issue is located. The problem is already solved.
Now, I need to figure out this step
Currently, I´m checking this docs https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.webbrowser?view=windowsdesktop-7.0
WebBrowser Class (System.Windows.Forms)
Enables a user to navigate Web pages inside a form.
Aight, any issue feel free to ask
Thanks a lot bro
<:cc_cat8:1046829995147923587>
Am I in the right section?
I think so
What u wanna do?
Let me show you what I'm working on
Change the name of the object?
I'm following this tutorial in order to be able to build my project https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/winforms
Get started with WebView2 in WinForms apps - Microsoft Edge Develop...
Getting started guide for using WebView2 for WinForms apps.
No
3. Create a Windows Forms project that contains a webBrowser object. Use the .Navigate method to navigate to a url.
So I got little stuck here
WebView2 is a much newer control.
Hmm I never worked with that control but, what u not comprehending from it? I think it's very clean what they are saying
Great to see again my man
Yeah this is what I noticed too
On source property u need to add the URI aka the url of the site
Yes
Once u add that it will be displayed on webview2
I just wanted to dabble check if it's the correct section
Ok
Then they say to save the project and run pressing F5
Yh it seems right
Ok! Let me do this too.
Yep
Also everytime u add a control normally u edit first the name of the control to his context:
WbvDisplayMicrosoft
Not the best example but.. hope u understand
I'll give a better example
Here we go
Ok! Yeah! You're right. Some developers told me the same yesterday here in the server.
Once u add the label control:
The property name will be by default: Label1
And if u add that label to indicate a specific section let's imagine List of Users.
The name of the Label1 should be LblListUsers .
So Labels u change to Lbl.., Textboxs to Txt.., etc..
Seems good
Best practice, so you can know what each control means and if u share the project to a friend he will know what each control work
My English not the best but I try my best to make u understand me
Yes
You are very correct brother. It's much easier to understand a project & code if you use correct clear names.
No, your English is perfect. Mine is not that good 😄
Where you from btw?
Sorry just arrived Home, im from Portugal fine dont worry
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.