Showing posts with label show. Show all posts
Showing posts with label show. Show all posts

Wednesday, February 4, 2026

Create Your First C# Windows Forms Application using Visual Studio

hey guys in this video I'm going to show
you how you can create your first
Windows Form application since C sharp
on your Visual Studio
so let's get started and let's see how
we can do it
so when you open Visual Studio it will
look like this here we are going to
create a new project so just click on
create a new project
and then here either you can search for
Windows Form application or you can just
select these drop Doms and select C
sharp here and the platform will be
desktop so you can just select windows
for example and then you can choose the
all project type and the project type
here is desktop and from here you can
see two Windows Form app options so here
we can select this option which is
Windows Form app using.net core so just
select this option and then click on
next
on the next window you can give the name
of your project I'm going to name my
project as my first project for example
and you can see I don't like to give
spaces in the project name so if
possible just write or give a project
name without spaces right and then click
on next
and here the framework will be dot net
6.0 or whatever is the latest version of
dotnet in my case it's dotnet 6.0 click
on create
and this is going to create a Windows
Form application in c-sharp for you so
now you can see my project has been
created
you will be able to see this kind of
solution on the left hand side and on
the right hand side you can see this
form one dot CS file so this is the
program file where you will write the
program
now how you can open the designer you
can see this form one dot CS file right
and when you just expand this uh you
will be able to see C sharp form one
designer also here right so when you
double click on this form one dot CS
file it's also going to open the
designer for you so just wait for the
designer to load for this form one so
now you can see this form one dot CS
design window is open
you can resize
this form one window here you can even
give the title to it right now the title
here is form one you can change the text
of this let's say you want to change the
text to uh my app and then press enter
the title has been changed to my app
right so you can change the text for
your form by just changing the title
here you have all the other options to
change the appearance of your form or
you can even change the font size
if you are using some fonts in your form
or you can also change the behavior of
your form so you can drag and drop some
components in your form from the toolbox
so if you don't see the toolbox just
click on this toolbox option here which
is going to load all the toolbox if you
want to pin the toolbox
window you can just click on pin and to
box window will be pinned here so you
can easily drag and drop all the
components from here
so you can see
all Windows Form components you can see
buttons labels and other components
I'm going to use a button so I'm going
to just drag and drop this button into
my form I can even use the label so I
can drag and drop this label into my
form
and let me also use the text box so let
me search for
this text box and put it here okay
so I can
you can see a drag and drop all these
components here now for this label
I can change the label text
from this
properties window so the text here is
label one I can just write
enter some text for example or enter
your value because I want the user to
enter something into the text box right
so I'm going to just write enter
some
text here and then press enter and you
can see this label shows that I will
just drag this text box here also
and now
in the behavior you will be able to see
uh all these Behavior options
I want to change the anchor option here
so you can see the anchor is right now
top and left I can even
click on this option to Anchor it to the
right side so what it's going to do is
let me just
resize it according to my form
and I can even
do the same for this label but I do not
need this for the label
so what I it's going to do is when I
anchor it to the right when I resize my
window you can see the text box resizes
right
same I can do with the button also so
this button text says button one I'm
going to just change it to
click me for example
and then press enter and you can see the
button text is changed
I can even change the anchor for it so
right now it's top left I can anchor it
to the right and then I can just move it
here and
then just
resize my button
until it shows this kind of
line here right
so now
when I even resize my window it's going
to uh
just resize according to the width of my
frame right I can even anchor this
button to the bottom so that
it moves to the bottom let's see how can
we do that so I can anchor it to the
bottom and then
what happens is when I just make it
bigger this button size becomes bigger
for example right so this is how you can
change the behavior so you need to play
with all these options and see what you
can do
for example I can change the background
color from here
so here I have all these options for
changing the background color
let's say I want to just choose this one
and then you can see the background
color of my form has been changed and
the background color of my button also
has been changed
so now let's write some code so what I
want to do here is whenever some text is
entered into this text box and when I
click the button I want to open a
message box with the same text for
example right so
the main thing to note here is the name
of this text box so when I select this
text box the name of the text box is
text box one so for using this name I'm
going to use this text box text and show
the text on the message box for example
right so just copy this ah name from
here and then select your click me
button just double click on this button
which is going to
create a listener for your button right
so the button name was Button one you
can even verify that by going here and
then you can see the name of this button
you can see the name of the button is
button one and the method which is
created is button one click listener
right so let me just write some code I'm
going to create a
string variable I am going to name it as
text is equal to and I am going to take
the name of my text box right which was
text box one so I'm going to just write
Dot
text which is going to uh
give me the text whatever I write in the
text box it's going to just take the
text and assign it to the text variable
right now I want to show this text into
a message box so I can just use a
message box component just write
message box
dot show
and then
I can just write
U entered and then semicolon space and
then plus and then the text variable
which is text okay once you are done
just save your code and then you can run
your code by just clicking on this run
Icon so I'm going to run my code
and hopefully everything works fine you
can see my code is running
when I resize you can see the button and
the text box resizes according to the
size when I move down the button size is
changed right now let me enter something
so I'm going to just write
Dom here and then I'm going to click on
click me button and it says you entered
Dom right I can just write 34 here and
I'm going to just click on click me and
it says you entered 34 okay
so it is going to open this message box
every time when I click on the button
and it's going to show whatever text I
wrote here
so this is the basic Foundation of how
you can create a Windows Form
application in Visual Studio using C
sharp and create your forms and use your
forms in Windows Form application so I
hope you've enjoyed this video and I
will see you in the next video

CMake Debugger

hi everyone today I'm going to show you
an exciting new feature in visual studio
for your cmic development my name is
Tina bakunja and I'm a product manager
here on the C plus plus team at
Microsoft focusing on cmake and
cross-platform development we have a new
cmake debugger integrated into Visual
Studio that allows you to debug your
cmic scripts and your cmake list.txt
files let's take a look at how it works
in Visual Studio
alright so now I'm in visual studio and
I have a cmake project open there's a
few different ways I can access the cmic
debugger from this point the first is I
can navigate to the project drop down
and select configure my project with
Scenic debugger this will spin up the
cmake debugger for this project
the next is I can also right-click any
of my cmake list.txt files in the
solution Explorer and the same option
will populate to open the cmake debugger
also if cmic cash generation fails for
any reason there will be a notification
that populates in the solution Explorer
to debug your project with the cmake
debugger
alright so now let's take a look at the
scenic debugger in action what I'll do
is open the cmakelist.txt file that I
want to debug I'm going to open the C
link list of txt file under the test sub
folder in this case
this file includes all of my testing
logic
I can start by setting a breakpoint for
my debugger on a line number and then
running the cmic debugger from the
project drop down
okay I can see that the IDE has entered
the debugging state in the locals window
I can see the state of the target I
defined under the added executable
command called test instant savior
I can expand to see more information
about this target like that it is using
ninja to generate and then I can scroll
down to verify that the source of this
target is set up properly
now let's watch the first test called
test one and step through the debugger
line by line I can step through this
code like any other debugger in Visual
Studio
I can now view the properties for this
first test that was set called pass
regular expression this can be super
useful as you get into larger cmic
projects as you can view all the state
of these types of variables at a given
point in time
as you can see in the locals window I
can also expand and view the state of
all of my cmake cache variables as I
step through code
I can set watches on variables by
right-clicking and selecting ad watch
these variables will now be watched in
the watch window
you can also navigate over to exception
settings and see the different C make
specific exceptions that you can set
your code to break on for example I'll
set a breakpoint on any warning that is
thrown and you'll see as I click through
my debugger and step through my code
that it will break on the first warning
message
this can be toggled to any other kinds
of Errors you see as well
all right so what do you think the cmake
debugger can allow a lot of insights
into your cmake projects at configure
time and works like any other debugger
would in Visual Studio as you could see
download the latest version of Visual
Studio play around with the cmic
debugger and please let us know your
thoughts we hope this helps you with
your cmake workflows and makes them a
lot more efficient also be sure to check
out the pure virtual C plus conference
on June 6th for more C plus plus content