C# Tutorial - Print DataGridView with Header and Footer | FoxLearn

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • Printing DataGridView with Header and Footer in C# step by step. (DGVPrinter: bit.ly/2PXclHn) The C# Basics beginner course is a free C# Tutorial Series that helps beginning programmers learn the basics of the C# Programming Language.
    Website: foxlearn.com
    DGV2Print - Print DataGridView As Report
    Printing DataGridview data with Header Footer in c#
    How to print multiple pages from datagrid with header and footer in c#
    How to print the header and footer in a grid with page count in c#
    c# - How to Print DataGridView with header image and footer?
    c# - Easy way to print out whole datagridview
    Form Printing with Datagrid View involving header and footer in c#
    Printing a DataGridView on DotNet Framework - CodeProject

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

  • @mindgamessoftwaredevelopme7726
    @mindgamessoftwaredevelopme7726 2 года назад +1

    DGVPrinter error after using DGVPrinter please help !!!!

  • @WaqasAli301
    @WaqasAli301 7 лет назад

    Thanks for the great video.

    • @foxlearn
      @foxlearn  7 лет назад

      Thank you so much :)

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

    nice video but its only display 3 columns instead of 5 column in my datagridview what ill be the problem

  • @masakrs
    @masakrs 7 лет назад

    Can you tell me is it possible to put landscape as default way of printing datagridview that im printing (idea is to rotate datagridview content before it hits the printer selection, so basically if I put landscape on printer it will print portrait), problem is that when I press "print" my printers are set to portrait by default, and I don't want change that coz ppl that r using my program usually print in portrait, so they will always have to change it just for this report

    • @foxlearn
      @foxlearn  7 лет назад

      Hi. You can view this video ruclips.net/video/-UB5mDPxAmo/видео.html to know how to do that. Thank you

  • @markfranklin2110
    @markfranklin2110 7 лет назад

    I have a problem where I am printing from a datagridview but each column is printed in a new page, can you please advise? Thanks

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, Make sure your code is correct. Please check again. Thank you

  • @localistanpakistan35
    @localistanpakistan35 8 лет назад

    its really awesome

  • @29miguel1996
    @29miguel1996 7 лет назад

    only work on visual basic 2015?

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, You can work with C#, VB.NET on visual 2013/2015 . Thanks

  • @dhancomendoza1624
    @dhancomendoza1624 5 лет назад

    is there any way to do this in vb.net

    • @foxlearn
      @foxlearn  5 лет назад

      OK. Thank you for your suggestion. I'll upload soon !

  • @jhwils
    @jhwils 7 лет назад

    does this work in visual studio 2010

    • @foxlearn
      @foxlearn  7 лет назад +1

      Yes, It can work

    • @jhwils
      @jhwils 7 лет назад

      Fox Learn thanks it work
      but who to change the row height

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

    @Fox Learn there's an issue when DataGridViewAutoSizeColumnsMode = Fill , the columns are separated in different pages, even I manually set it to None before passing it to PrintDataGrid, is there a workaround here? PS: When the DataGridViewAutoSizeColumnsMode = None on runtime , its working fine

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

      Thank you. Let me check again

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

    is it possible to add an image as header....? or any suggestions so i can modify your DGVPrinter Class to tweak.....

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

    Great information and great video! but You should give Credit to Vijay Thapa for using DGVPrinter github.com/vijaythapa333/DGVPrinter and give copyright notice.

  • @hamzik2255
    @hamzik2255 8 месяцев назад

    this is amazing bro but why this doesnt work forme when i have more columns like 15 or more?

  • @cleyva
    @cleyva Год назад

    Hello, could you please help me with the code to download the DGVPrinter?

  • @kusumnet
    @kusumnet Год назад

    where is the class DGVPRINTER Can you please show what you wite in that?

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

    Thanks for this and then how use it in WPF application project ?

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

    Hey! How can I adjust number of columns in printview? It prints only 3 columns in one page and takes others to next page.

  • @luqmanehassane7609
    @luqmanehassane7609 5 лет назад

    Hi everyone, someone can help me to get dgvprinter.dll?

  • @shaheerkhalid2632
    @shaheerkhalid2632 Год назад

    can anyone mail me this DGV2Print file ?

  • @raffaele6577
    @raffaele6577 2 года назад +1

    Hello, How Can I fit the columns of the DGV in one page? Now when I print the DGV I see more than 1 page because the DGV is too large..

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

      Hey I'm trying to figure out how to do this could you share, if you found a solution?

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

      @@lazerlight3385 I used report RDLC and I put only the relevant columns

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

    Can you please solve this error in your given DGVPrinter file
    System.ComponentModel.Win32Exception: 'A StartDocPrinter call was not issued'

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

      OK. Thank you. I'll check again

  • @ishakmco3186
    @ishakmco3186 Год назад

    Please link icant access to download class

  • @AyeshaKhan-cn1id
    @AyeshaKhan-cn1id 2 года назад

    I cannot call DGVPrinter class

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

    Nice videos and music

  • @agbsoftware8018
    @agbsoftware8018 7 лет назад +1

    Thanks for share :)
    i have a question
    with your class
    how can write a text under datagridview, ? i need write the subtotal, and total

  • @kashikhamani2500
    @kashikhamani2500 6 лет назад +1

    How do i increase Title fontsize

    • @foxlearn
      @foxlearn  6 лет назад

      Please try [your_grid].TitleFont = new Font("Times New Roman", 15.0f); . Thank you !

  • @hieplee5373
    @hieplee5373 7 лет назад +1

    Would you please show an example of how to print without prompting a print dialog? Thank you.

    • @foxlearn
      @foxlearn  5 лет назад

      bit.ly/2PXclHn . Thank you !

  • @gameplaymemoriesYT
    @gameplaymemoriesYT 7 лет назад +1

    Great Work Fox Learn!
    btw how can I change the header font style? and also my datagridview have a color alternative, how can i print only some column and without the color in header and row?

  • @abraofrancisco7198
    @abraofrancisco7198 7 лет назад +1

    Hi Fox Learn!
    How can I set the page on horizontal ?

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

      I was also looking for this funcuon. Thank you.

  • @sehhabadry4881
    @sehhabadry4881 7 лет назад +2

    how to print Landscape

  • @waqarhussain5685
    @waqarhussain5685 7 лет назад +1

    please give me link to download DGVPrinter

  • @ishakmco3186
    @ishakmco3186 Год назад

    Help me 😢😢😢😢😢

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

    Very nice, thank you for this explanation. I have a question. Q=When I print it I have 4 columns. It will print 2 columns on one page and 2 on another page. When I set Landscape it will print 3 columns on 1 page and 1 on the next. Is there a way to control column width. I saw DGVPrinter.ColumnWidthSetting but can not figure out how the column width is controlled. Any help appreciated pls.

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

      Ok, hrm if you make the DGV smaller in the forms it prints on one page hehe. I would still like to figure out a command to change column width if anyone knows lol.

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

      @@coregamestudio did you solve this problem?

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

      @@coregamestudio did you solve the problem

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

    Too fast tutorial

  • @insomanic778
    @insomanic778 5 лет назад +2

    Man, you saved my job! This class is amazing! Thank you so much!

    • @foxlearn
      @foxlearn  5 лет назад +1

      You're welcome. thank you !

  • @akhterhussain100
    @akhterhussain100 5 лет назад

    how to print number of copies of one label ,i want input field for number of copies printing asp.net c#

    • @foxlearn
      @foxlearn  5 лет назад

      What do you mean? can you describe more details.

    • @akhterhussain100
      @akhterhussain100 5 лет назад

      @@foxlearn i want to print one page multiple time ,by input number of pages/copies to be print

  • @siddalingeshapatil8973
    @siddalingeshapatil8973 7 лет назад

    Hi.....My all code is correct but after printing i m getting each column in separate page only.....Please Any Answers ?????????????????????????????????????????????????????????

  • @CH-qw6yy
    @CH-qw6yy 4 года назад

    I loaded up the code and there are an abundance of errors. Not sure how everyone else got it working but as is I have a bunch of errors. So many its not worth trying to figure it out.

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

    I'm creating the data in the datagridview virtually, but when I get the output, I encounter an empty table. What could be the reason?

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

    Thanks bro..you give me an idea for my next project..😀

  • @bertugfahriozer4675
    @bertugfahriozer4675 7 лет назад

    you must add this code for LANDSPACE -> printer.PageSettings.Landscape = true;

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

    ok, but how can I format the columns and rows dimensions and get sure that the datagridview will correctly put on a single page? cause if I have a "long" grid, with a lot of columns and long values in rows, I've seen that the procedure puts the grid on more sheets. how can I link the page dimensions with the datagridview rows and columns dimensions?

  • @iandrilon8671
    @iandrilon8671 6 лет назад

    I Have an error it showing The call Ambiguous between the following methods or properties how to solve this ?

  • @jonathanvargas8371
    @jonathanvargas8371 7 лет назад

    I congratulate you are very good your videos recently you are sealed but I like many your videos is more recommended to my friends to follow you

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

    why isn't savefiledialog opening when i click print
    please help me

  • @Unknown-bm5ui
    @Unknown-bm5ui 3 года назад

    شكرا جزيلاً لك.
    مبارك من قبل الرب❤️🤲.

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

    thanks, How to print preview.

  • @ahmadarbilli4927
    @ahmadarbilli4927 6 лет назад

    pls how can i get DGVPrinter.dll file

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

    Hola nos podría habilitar el DGVPrinter para poder descargarlo

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

    how do i print multiple datagriedview under each other ?

  • @ranjkurdish
    @ranjkurdish 5 лет назад

    i usfull on your channale

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

    Thank you, can you add the print code from right to left

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

    where to copy the dgvprint.cs, sir? Is it directly copy dgvprinter.cs to our projectfile? coz i dont see it when i try refreshing it inside visual studio interface

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

      well, i can make it manually from adding c# class. The thing is why can't I make model from database which already has table data? I mean it can be selected, but it wont appear in the model entities.

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

    where to get dgvPrinter class?

  • @ishakmco3186
    @ishakmco3186 Год назад

    ❤❤❤❤

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

    Thank you very much........................

  • @unpocodetodo-twitch7006
    @unpocodetodo-twitch7006 4 года назад

    in visual 2010 ?

  • @David-uc9dc
    @David-uc9dc 4 года назад

    in my Datagridview I have 11 rows but when I print it only comes out 7, how can I solve it?

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

      found a solution to the issue?

  • @iandrilon8671
    @iandrilon8671 5 лет назад

    I Have an error it showing The call Ambiguous between the following methods or properties how to solve this ?

    • @foxlearn
      @foxlearn  5 лет назад

      You need to specify the method or property. for method should use method_name(parameter...) or not parameter. and property (myclass m = new myclass(); m.Test = 123). Thank you !

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

    I got some error

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

      What error are you getting?

  • @md.abdullahalmurad2312
    @md.abdullahalmurad2312 4 года назад

    How can i print the values vertically in printed page?

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

    Is it possible to export it as pdf?

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

    Thanks ...Just perfect working..Excelente....

  • @WaqasAli301
    @WaqasAli301 7 лет назад

    will u please tell me how can i Print to file instead of direct printing? i am stuck at this as i have to save document in pdf. reply please

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, You need to install adobe pdf or pdf viewer. You can save the document to pdf file. thanks

  • @jonathanvargas8371
    @jonathanvargas8371 7 лет назад

    good evening!
    You could make the data of a datagrid be sent to another but of different form:
    Ejp: that the datagrid1 that you are in fom1 is sending data to the form2 of the datagrid2 and later and printing them

  • @chitwn911
    @chitwn911 5 лет назад

    How to Print on Legal Sized Paper Automaticaly>

    • @foxlearn
      @foxlearn  5 лет назад

      Can you describe more details. thank you !

  • @iostreamdoteych6013
    @iostreamdoteych6013 7 лет назад

    is this working on MySql Database?

  • @Gol_D_Roger_The_Pirate_King
    @Gol_D_Roger_The_Pirate_King 7 лет назад

    DGVprinter link is broken.

  • @kashikhamani2500
    @kashikhamani2500 6 лет назад

    how can we increase grid header and rows column height and width on printing time
    thanks.

    • @foxlearn
      @foxlearn  6 лет назад

      You should use rdlc or crystal report, print datagridview too simple. Thank you !

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

    It works well for my form apps, thanks, can you also modify it in order to work for WPF?

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

      OK. Thank you for your suggestion. Let me try to research

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

    It's real is good content :)
    Very helpful class :)

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

    nice proyect, this helpme much, thanks.!!!!

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

    thank you for all...

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

    thank you very much
    Do you have a VB.Net tutorial like this?

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

      At this time no, but i'll upload soon

  • @govindsarda6919
    @govindsarda6919 7 лет назад +1

    you are the BEST Bro...!!!!!!

    • @foxlearn
      @foxlearn  5 лет назад

      Thank you so much !

  • @bluevels
    @bluevels 6 лет назад

    Hi thanks very much for the video, helped me a lot. I want to know if you can add a normal text after the datatable.

  • @makatinggolteb
    @makatinggolteb 7 лет назад

    Hi, I have 9 Columns in my dgv, how do i make the printing to be landscape? TIA

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, You can set
      PrintDocument pd = new PrintDocument();
      pd.DefaultPageSettings.Landscape = true;
      Please try again. Thank you so much !

  • @benjamarporns3319
    @benjamarporns3319 8 лет назад

    Copy DGVPrinter file to anywhere?

    • @foxlearn
      @foxlearn  8 лет назад

      Hi, You can download below this video. Thanks

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

    Very informative

  • @shubhamsahuSD
    @shubhamsahuSD 6 лет назад

    can you video on creating a sql data structure for attendance in which employee or student names comes from another table. but i am bit confuse about attendance table dsign

    • @foxlearn
      @foxlearn  6 лет назад +1

      OK. Thank you for your suggestion

  • @UmarFarooq-jn7dt
    @UmarFarooq-jn7dt 4 года назад

    Thanks for the script. Means a lot.

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

    thank you very much you help me a lot I love your channel

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

      You’re welcome. Thank you

  • @sheikhshuaib8451
    @sheikhshuaib8451 7 лет назад

    Hi ,great video but i have around 15 columns, so please show how to print the datagridview in landscape
    thanks

    • @BigWaveyDavey
      @BigWaveyDavey 5 лет назад

      printer.PageSettings.Landscape = true;

  • @ajitnimbalkar2753
    @ajitnimbalkar2753 7 лет назад

    Nice Tutorial. can u tell me how to show this two words like "Members" in left position and "Amount" in right position in footer.

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, This .dll don't support. You can use Report Viewer. thanks

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

    Thank you very much, idols

  • @kennethivanmaduro1778
    @kennethivanmaduro1778 6 лет назад

    how to adjust the paper size?

  • @EHPADservice
    @EHPADservice 6 лет назад

    Sent me source code please

  • @rangagurusinghe104
    @rangagurusinghe104 7 лет назад

    Hi, my project language is VB , don't you have same solution in vb ?

    • @foxlearn
      @foxlearn  7 лет назад +1

      I'll upload version vb.net as soon as possible. Thank you

    • @rangagurusinghe104
      @rangagurusinghe104 7 лет назад

      thank you, I appreciate it. by the way I have another thing to know. If I hide a column in datagridview and then print , will it print the hided one as well or no ? Actually I want to print only visible columns and data in datagridview.

  • @kirankumary.k4062
    @kirankumary.k4062 7 лет назад

    DGVPrinter.cs its Library Files? or program fiel? can you help me...
    if it is library file means send link plz
    one more Northwind.bak file also library file?
    send me a link how to donload and import it
    waiting for ur reply Thank You

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, DGBPrinter.cs is a class library, You can download Northwind database at northwinddatabase.codeplex.com/ .Thank you

    • @kirankumary.k4062
      @kirankumary.k4062 7 лет назад

      Thank You
      Can you send video link how to import northwind database to vb10

    • @kirankumary.k4062
      @kirankumary.k4062 7 лет назад

      can you plz send me the video how to import Northwind library to visual studio 10

  • @sergiogman
    @sergiogman 6 лет назад

    thank you very much!! Recommended

  • @darkblazer425
    @darkblazer425 5 лет назад

    Hi! How can i change the font style in title and subtitle thanks.!

    • @foxlearn
      @foxlearn  5 лет назад

      Print DataGridView too simple, you should use RDLC report, then you can change font size...etc

  • @makatinggolteb
    @makatinggolteb 7 лет назад

    Hi, how do I write something on this report, for example I want to write something "Welcome" between the TItle and Subtitle? and also how can I input a logo in here? Thanks!

    • @makatinggolteb
      @makatinggolteb 7 лет назад +1

      nvm, I solved it by having
      printer.printDocument.PrintPage += PrintPage; and a PrintPage method, in this way you can modify the printing of document like adding images or your own texts with specified locations. PLEASE LIKE SO OTHERS CAN SEE THIS, IT WOULD HELP FOR SOMEONES. THANKS FOXLEARN!

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, I think you should use Report Viewer instead print datagridview, see this video to solve ruclips.net/video/ek9FAXvTqGs/видео.html , ruclips.net/video/JoiLvAmksco/видео.html . Thank you

    • @BigWaveyDavey
      @BigWaveyDavey 5 лет назад

      Perhaps an easier way is to just insert a CR/NL after your title followed by welcome text: printer.Title = "First Line Title Here
      Welcome Message Here"

  • @muhammadhassaan262
    @muhammadhassaan262 5 лет назад

    Hi There..
    I'm trying to print a data grid view but i'm getting 5 columns in one page and 4 columns on the other page..
    Can you help me how to solve it??

    • @muhammadhassaan262
      @muhammadhassaan262 5 лет назад

      I've tried to change page preference to portrait to landscape. but tits not working..

    • @foxlearn
      @foxlearn  5 лет назад +1

      I think you should use rdlc or crystal report. print datagridview too simple

    • @muhammadhassaan262
      @muhammadhassaan262 5 лет назад

      @@foxlearn okay thanks..! :)

  • @AsmULUSOY
    @AsmULUSOY 7 лет назад +1

    süppppppperr

  • @mahfuzurrahman2248
    @mahfuzurrahman2248 7 лет назад

    It is very helpful .. Thanks to fox learn team..
    I am having a problem in printing
    " When my DataGridVeiw contains more than 7 or 8 columns it prints rest columns in another page "
    So I need help how can i minimize the DataGridVeiw Size so that it can print more than 8 columns in one page
    Thanks in advance

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, I think you should use Report Viewer or Crystal report: See ruclips.net/video/079OLMGqZwg/видео.html / ruclips.net/video/ek9FAXvTqGs/видео.html . Thank you

    • @sameerkhatri1918
      @sameerkhatri1918 7 лет назад

      Hello Sir, If you have got the solution for this please let me know ASAP. Thanks.
      You can email me on ersameer.khan05@gmail.com

  • @chesterdelsocorro6225
    @chesterdelsocorro6225 6 лет назад

    i have a number in rowheader but when i print, the cell was empty. i used printer.PrintRowHeaders = true;

    • @foxlearn
      @foxlearn  6 лет назад

      What error are you getting?

    • @chesterdelsocorro6225
      @chesterdelsocorro6225 6 лет назад

      @@foxlearn it does'nt have an error but the rowheader are empty when i print it out. i want the row number to be included in printing but it turn out blank. the rowheader contains the row number.

    • @foxlearn
      @foxlearn  6 лет назад

      You should use Report, print datagridview too simple

  • @deepanshukumar1905
    @deepanshukumar1905 6 лет назад

    How to print image in header using print datagridview?

    • @foxlearn
      @foxlearn  6 лет назад

      Print data gridview very simple, you should use report. see my video about report. Thank you !

    • @deepanshukumar1905
      @deepanshukumar1905 6 лет назад

      @@foxlearn thanks

  • @gameplay4u296
    @gameplay4u296 7 лет назад

    its very helpful thanxxxx FOX LEARN..i have a little problem i want to get data specific according to query not all the table to print..what should i do plz help....

    • @foxlearn
      @foxlearn  7 лет назад

      Hi, You can use linq to query data For Example (var query = from o in db.Customers where o.City == "Your condition" select o).ToList() Thanks you

    • @gameplay4u296
      @gameplay4u296 7 лет назад

      Thank u soo much ..............

    • @gameplay4u296
      @gameplay4u296 7 лет назад

      i can use (and) with where clause?????????? how???????

    • @foxlearn
      @foxlearn  7 лет назад +1

      Hi, You can use where o.City == "Your condition" && o.PostalCode == "Your postal code". Thanks

    • @gameplay4u296
      @gameplay4u296 7 лет назад

      Thank uuuuuuuu soo much....my problem solved thax for your guide..

  • @RohitKumar-ys4ow
    @RohitKumar-ys4ow 3 года назад

    can I use this in WPF aswell?

  • @so2mali
    @so2mali 7 лет назад

    Thanks a lot.. It's very helpful..