How to use DataGridView Control in C#

Поделиться
HTML-код
  • Опубликовано: 9 ноя 2024

Комментарии • 71

  • @fallingman8470
    @fallingman8470 2 года назад +23

    That cursor is so visible! I had no trouble locating the cursor during this video. 10/10

  • @dreirxge
    @dreirxge 2 года назад +2

    Omg this is exactly what I need. I have absolutely no knowledge on how to use visual studio. Thank you very much. Have a nice day :)

  • @abdelmalektalbi7582
    @abdelmalektalbi7582 4 года назад +11

    I hate when my teachers take their time to explain what they're typing, explaining the obvious.
    Best tuto ever!
    one small detail ,it would have been a wonderful addition if you posted the code to...

    • @ProgrammersNerds
      @ProgrammersNerds  4 года назад +1

      We aim to provide hands on and direct to the point tutorials.

  • @dineshodedra4460
    @dineshodedra4460 3 года назад +3

    Great video. I'm new to C# but have lots of "lapsed" coding experience. I loved the way you created the class objects and the list to use with the grid. These tutorials are for beginners so it was perfect. I have seen so many othe tutorials that make the guy on the video sound clever but they struggle to get the main objective across.
    For completness, you could have updated the data in one of the cells with the text you edited.
    Great work, keep it up

    • @ProgrammersNerds
      @ProgrammersNerds  3 года назад +1

      Thanks for your feedback. I try to make short vids, busy days nowadays

  • @christopherlikins6321
    @christopherlikins6321 3 года назад +3

    Thank you for this instruction. It is very clear and well stepped through on the procedure.

  • @jesusstudentbrett
    @jesusstudentbrett 2 года назад +3

    I certainly appreciate your work and sharing this, but just a heads up; the audio is just barely loud enough (youtube max volume and my PC on max volume).

    • @ProgrammersNerds
      @ProgrammersNerds  2 года назад

      Thanks, they were recorded with laptop mice so I understand you its a bit low :(

  • @viktoria7don
    @viktoria7don 4 месяца назад +1

    Мужик, ты лучший, просто это знай

  • @hemalpatel9708
    @hemalpatel9708 2 года назад

    Nice tutorial, It helps me to create a view for data using data grid view, before I was creating custom UI for editing and viewing purpose, but Now I decided to use custom UI to provide basic data to user for records and use data grid view to view all data to user! Thanks a lot!

  • @oscaraward6187
    @oscaraward6187 4 года назад +5

    Nice tutorial but how do I update the data as well as add and remove rows? I added an update, add, and remove button but I'm not sure what code to use.

    • @Lhsbysareena
      @Lhsbysareena 3 года назад +1

      Add databound button
      In the button click event you can give operations code

    • @hemalpatel9708
      @hemalpatel9708 2 года назад

      You can Add record directly to the list instead because I think Data grid view will use the list to display data, but you might have to update the data grid view

  • @williamazz2113
    @williamazz2113 2 года назад

    Excellent tutorial. Great style. You covered the perfect amount of information for a complete sample solution. Thanks for sharing.

  • @陳昱辰-e5p
    @陳昱辰-e5p 5 лет назад +4

    This is really really helpful ! !

  • @ragtop63
    @ragtop63 3 года назад +2

    Excellent video!
    Also, it sounds like your computer's fan curve is very aggressive lol

  • @dimankan
    @dimankan 3 года назад

    i want to see more about datamember, datasource and binding

    • @ProgrammersNerds
      @ProgrammersNerds  3 года назад +1

      Binding is so easy, for your reference. DataSource accepts all sorts of IList, DataMember is the value of the column from the dataSource SET, DataValue is what is returned on the click. Please, see other videos as I believe I have used it somewhere.

  • @JoshuaPraiz
    @JoshuaPraiz 5 месяцев назад

    Awesome!!!

  • @Laugny
    @Laugny 3 года назад +1

    it says inconsisten accessability: property type 'list' is less accessible then Property 'Form1.People'

    • @Laugny
      @Laugny 3 года назад +1

      i fixed it lol

    • @ProgrammersNerds
      @ProgrammersNerds  3 года назад +1

      good (Y)

    • @danielruzsik6440
      @danielruzsik6440 3 года назад

      @@Laugny how did you fix it?

    • @Laugny
      @Laugny 3 года назад

      @@danielruzsik6440 Ohh, im sorry i dont know anymore, this project is about 3months old and i dont have a clue how i fixed it, but it wasnt that hard i think

    • @danielruzsik6440
      @danielruzsik6440 3 года назад +1

      @@Laugny not a big deal, thanks anyway :D

  • @krastinabrunson34
    @krastinabrunson34 3 года назад

    Awesome, you helped me understand dgv. Thank you. Do you logically after of course learning you figured how to set button or text box controls?

    • @ProgrammersNerds
      @ProgrammersNerds  3 года назад

      Every time you update the dgv, you can set text property for example to count number of rows or so.

    • @krastinabrunson34
      @krastinabrunson34 3 года назад

      @@ProgrammersNerds I did that but the Delete is not working in random order with the code. It just deletes 1st,2nd,3rd, when i try to select 5th it deletes the 1st.
      How do set it up to work at random selection of row?

    • @ProgrammersNerds
      @ProgrammersNerds  3 года назад

      @@krastinabrunson34 every control in Windows Forms, has a Tag object property, you can attach your object here, like a class instance which represents your row, and then you have to get the selected row, through dataGridView1.SelectedRows[0], and then you get the object from .Tag and cast it to your object. and in the object you will have some sort of ID that represent your PrimaryKey i your Table. If you have problems, please share your code and I will be glad to help.

  • @sarimsheikh140
    @sarimsheikh140 6 месяцев назад

    Sir how do u duplicate using drag ?????

  • @ardiansanando59
    @ardiansanando59 3 года назад

    thank you very much!!

  • @limtseng7157
    @limtseng7157 3 года назад

    thank you, this is really helpful.

  • @tomd5678
    @tomd5678 4 года назад +1

    Great, I learned some good stuff

  • @scarr6606
    @scarr6606 2 года назад

    At 2:36 you remove "throw new NotImplementedException();" and I receive errors when I remove it. Any suggestion's?

  • @unabletoluxury
    @unabletoluxury 3 года назад

    Thank you very much

  • @mejmeiji2008
    @mejmeiji2008 2 года назад

    I hope there's a button to enter then view in datagridview

  • @bashayerm2412
    @bashayerm2412 2 года назад

    Hi
    I have problem in passing data in grid view, if it’s possible can you help me
    Thank you

    • @ProgrammersNerds
      @ProgrammersNerds  2 года назад

      Any IEnumerable, IList passed to the list.DataSource will work

  • @dimankan
    @dimankan 3 года назад

    спасибо

  • @VarunKumar-qd5wl
    @VarunKumar-qd5wl 4 года назад +1

    Thank you

  • @emregecer1216
    @emregecer1216 3 года назад

    Hi, i'm trying to write program which is has to connect ftp server and take , add and delete data data from server. I have no idea how to do it. i have server http address also id and pass. Can you show us how to do that if its not so hard? i watched some videos already but they have path of files, I dont have path just address of server

    • @ProgrammersNerds
      @ProgrammersNerds  3 года назад

      Hi Edgar, this is what you need to do (an example):
      using (var client = new WebClient())
      {
      client.Credentials = new NetworkCredential(ftpUsername, ftpPassword);
      client.UploadFile("ftp://yourfile.txt", WebRequestMethods.Ftp.UploadFile, localFile);
      }

  • @tomljenovicvid61
    @tomljenovicvid61 2 года назад

    Is it even possible for me to load pictures from online database in fowlayoutpanel, then on click enter a new form with only selected object (i managed these two things) but then I want to have a button "add to cart" which is a completely separate form. The cart should be consisted solely of datagridview which collects products added to it. Right now I can only showcase each last added product. It seems they dissappear as soon as I leave the form (cart) with datagrid on it.

    • @ProgrammersNerds
      @ProgrammersNerds  2 года назад

      Of course, usually online images or files rely on some file server to be served, and accessed via urls. Having accessed the resources and created image objects you can displat them anywhere

  • @antoni9001
    @antoni9001 4 года назад +2

    Good movie

  • @Ravenovskii
    @Ravenovskii 4 года назад

    DUDE YOU ARE SO FUCKING AMAZING

  • @adematabag9161
    @adematabag9161 3 года назад

    Could you please comment me the shortcut keys you use? You are coding very fast.

    • @ProgrammersNerds
      @ProgrammersNerds  3 года назад +2

      Hello Adem, coding fast is because of my experience with coding. let me give you an example. if you want to write code like Console.WriteLine / / use write Console.WL + Tab it generates automatically. If you want to create a property on your class then write: prop + double tab, etc etc.

  • @yigitkeles3217
    @yigitkeles3217 2 года назад

    4:53

  • @mikaverhoeven3513
    @mikaverhoeven3513 7 месяцев назад

    drag n drop, really man?

  • @RonTDC
    @RonTDC 3 года назад

    Great video, but you type superfast lol

  • @kenwatson378
    @kenwatson378 4 года назад

    Seriously? You cant build your project and class ahead of time. I know how to create a class and add items to a list. Why waste everyone's time by not setting up ahead of time so you can show us what the video was SUPPOSED to be about?

    • @FiksIIanzO
      @FiksIIanzO 4 года назад +8

      Because it takes very little time and complete newbies watch these videos along with rusty professionals. The newbies would be lost without a proper step-by-step. If you're a huge dude and your time costs five bucks a second, read documentation. That's dense and quick if you know what you're doing. Otherwise check your attitude.

  • @Barbarossa-jb6cv
    @Barbarossa-jb6cv 2 года назад +1

    public partial class Form1 : Form
    {

    SqlConnection con = new SqlConnection(@"Data Source = LAPTOP-2A5CNVC3\SQLEXPRESS; Initial Catalog = Countries; Integrated Security = True");
    SqlCommand cmd = new SqlCommand();
    public Form1()
    {
    InitializeComponent();
    }
    private void btnClear_Click(object sender, EventArgs e)
    {
    dgvShowData.DataSource = null;
    }
    private void btnExit_Click_1(object sender, EventArgs e)
    {
    Application.Exit();
    }
    private void btnShow_Click_1(object sender, EventArgs e)
    {
    try
    {
    con.Open();
    cmd = new SqlCommand("Select * from Coutnry", con);
    cmd.ExecuteNonQuery();
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataTable dtable = new DataTable();
    da.Fill(dtable);
    dgvShowData.DataSource = dtable;
    con.Close();
    }
    catch
    {
    MessageBox.Show("Error 404");
    }
    }
    private void dgvShowData_CellContentClick(object sender, DataGridViewCellEventArgs e)
    {
    }
    }
    }

  • @vicenzovendetta3443
    @vicenzovendetta3443 2 года назад

    Thank you